问答题【说明】Point是平面坐标系上的点类,Line是从Point派生出来的直线类。 #include <iostream.h> class Point public: Point (int x, int y) ; Point (Point &p) ; ~Point(); void set (double x, double y) ; void print(); private:double X,Y; ; Point::Point (int x, int y) Point 构造函数 X=x; Y=y; Point::Point ( (1) ) Point 拷贝构造函数 X=p.X; Y=p.Y; void Point::set (double x, double y) X=x; Y=y; void Point::print() cout<<’ (’<<X<< , <<Y<< ) <<endl; Point::~Point() cout<< Point 的析构函数被调用! <<endl; class Line: public Point public: Line (int x, int y, int k) ; Line (Line &s) ; ~Line(); void set (double x, double y, double k) void print(); private:double K; ; (2) Line 构造函数实现 K=k; (3) Line 拷贝构造函数实现 K=s.K; void Line::set (double x, double y, double k) (4) ; K=k; void Line::print() cout<< 直线经过点 ; (5) ; cout<< 斜率为: k= <<K<<endl; Line: :~Line() cout<< Line 析构函数被调用! <<endl; void main() Line 11 (1,1,2) ; 11 .print(); Linel2 (11) ; 12.set (3,2,1) ; 12.print();