景昔 的回复 更多..
-
#include<iostream> #include<cmath> using namespace std; class Point{ public: Point(int xx=0,int yy=0) { x=xx; y=yy; } Point(Point &p); int getX(){return x;} int getY(){return y;} private: int x,y; }; Point::Point(Point &p) { x=p.x; y=p.y; cout<<"Calling the copy constructor of Point"<<endl; } class Line{ public: Line(Point xp1,Point xp2); Line(Line &a); double getLen(){return len;} private: Point p1,p2; double len; ...
-
#include <iostream.h> const double PI = 3.14; class Shape { public: virtual double area()=0; virtual double surface_area()=0; virtual double volume()=0; }; class Circle:virtual public Shape { protected: double r; public: Circle(double x){ r=x;} double area(){ return PI*r*r; } double surface_area(){return 0;} double volume(){return 0;} }; class Ball:virtual public Circle { public: Ball(double x):Circle(x...