xt12-3-2.cpp
上传用户:liubin
上传日期:2022-06-13
资源大小:85k
文件大小:0k
- #include <iostream>
- using namespace std;
- class Point
- {public:
- Point(float a,float b):x(a),y(b){}
- ~Point(){cout<<"executing Point destructor"<<endl;}
- private:
- float x;
- float y;
- };
- class Circle:public Point
- {public:
- Circle(int a,int b,int r):Point(a,b),radius(r){}
- ~Circle(){cout<<"executing Circle destructor"<<endl;}
- private:
- float radus;
- };
- int main()
- {Point *p=new Circle(2.5,1.8,4.5);
- Circle *pt=new Circle(2.5,1.8,4.5);
- delete pt;
- return 0;
- }