试题7-4-4.txt

来自「为C++学习者」· 文本 代码 · 共 20 行

TXT
20
字号
#include<iostream.h>
#include<malloc.h>
class Rect
{
public:
	Rect(int l,int w){length=1;width=w;}
	void Print(){cout<<"Area:"<<length*width<<endl;}
	void* operator new(size_t size){return malloc(szie);}
	void operator delete(void *P){free(p);}
private:
	int length ,width;
};
void main()
{
	Rect *p;
	p=new Rect(5,4);
	p->Print();
	delete p;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?