![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++学习
静安书以沫
知识是一点点积累的,路是一步步走出来的
展开
-
C++类与对象
#include<iostream.h> using namespace std; class clock { public : void settime(int new_hour,int new_minute,int new_second); void showtime(); private: int hour,minute,second; }; void clock::settime(int new_hour,int new_minute,int new_second) {原创 2020-11-05 09:03:20 · 84 阅读 · 0 评论 -
C++组合类
#include<iostream> #include<cmath> using namespace std; class A { public: A(int xx=0,int yy=0){x=xx;y=yy;cout<<"A_init1"<<endl;} A(A &a){x=a.x;y=a.y;cout<<"A_init2"<<endl;} int getx(){return x;}原创 2020-11-05 09:02:00 · 254 阅读 · 0 评论 -
C++析构函数
#include"iostream" /************************** 析构函数在对象被删除前一刻被调用 无返回值,不接受任何参数 ****************************/ using namespace std; class point { public: point(int xx,int yy) {原创 2020-11-05 09:01:27 · 59 阅读 · 0 评论 -
C++前向引用声明
#include<iostream> #include<cmath> using namespace std; class A; class B;//前向引用声明 class A { public: A(int xx=0,int yy=0){x=xx;y=yy;cout<<"A_init1"<<endl;} A(A &a){x=a.x;y=a.y;cout<<"A_init2"<<endl;}原创 2020-11-05 08:53:39 · 585 阅读 · 0 评论 -
C++构造函数
C++构造函数 #include<iostream> /********************************** 构造函数在创建对象时被调用 ***********************************/ using namespace std; class point { public: point(int xx,int yy) /原创 2020-11-05 08:52:57 · 89 阅读 · 0 评论