shiti7_4_4.cpp

来自「为初学者提供的最佳的C++程序设计源程序库」· C++ 代码 · 共 20 行

CPP
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(size);}
	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 + -
显示快捷键?