📄 class.h
字号:
#include <iostream>
using namespace std;
class c1
{
public:
c1();
c1(int i);
~c1();
private:
int d;
};
c1::c1()
{
cout <<"Orignal C1 constructor is running..." <<endl;
}
c1::c1(int i)
{
cout <<"C1 constructor with parameter is running..." <<endl;
d=i;
}
c1::~c1()
{
cout <<"C1 destructor is running..." <<endl;
}
class c2
{
public:
c2();
c2(c2 &t);
~c2();
private:
c1 a;
c1 b;
};
c2::c2():b(3),a()
{
cout <<"C2 constructor is running..." <<endl;
}
c2::c2(c2 &t):b(t.b),a(t.a)
{
cout <<"C2 cloner is running..." <<endl;
}
c2::~c2()
{
cout <<"C2 destructor is running..." <<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -