📄 01.cpp
字号:
#include<iostream.h>
#include<malloc.h>
class Rect
{
int length,width;
public:
Rect (int l,int w)
{
length=l,width=w;
}
void disp()
{
cout <<"面积"<<length*width <<endl;
}
void *operator new (size_t size)
{
return malloc(size);
}
void operator delete (void *p)
{
free (p);
}
};
void main()
{
Rect *p;
int l,w;
cout<<"Enter the length:";
cin>>l;
cout<<"enter the width:";
cin>>w;
p=new Rect (l,w);
p->disp();
delete p;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -