📄 新建 文本文档.txt
字号:
#include<iostream.h>
class TA
{
public:
TA(){cout<<"construction the class TA"<<endl;}
~TA(){cout<<"destruction the class TA"<<endl;}
void f(){cout<<"You are the best boy"<<endl;}
};
class TsmartA
{
public:
TsmartA (TA* pt):ptr (pt){cout<<"construction the class TsmartA"<<endl;}
~TsmartA()
{
cout<<"destruction the class TsmartA"<<endl;
delete ptr;
}
TA* operator->() {return ptr;}
operator bool(){return ptr;}
private:
TA* ptr;
};
int main()
{
TsmartA sa(new TA);
// sa->f(); //在这里相当于sa.operator->())->f()
if(sa)
sa->f();
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -