#include<iostream>
using namespace std;
class Point
{
public:
Point(double a=0,double b=0):xx(a),yy(b){}
virtual double x(){return xx;}
virtual double y(){return yy;}
private:
double xx,yy;
};
class t_Point :public Point
{
public:
t_Point(double a=0,double b=0,double c=0):Point(a,b),zz(c){}
double z(){return zz;}
private:
double zz;
};
//:public
int main()
{
Point a(8,8);
t_Point b(2,1,8);
cout<<a.x()<<a.y()<<endl<<b.x()<<b.y()<<endl;
cout<<b.z();
return 0;
}
时间: 2024-10-07 06:44:34