标签:bsp out class space turn 虚方法 virt return public
#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;
}
标签:bsp out class space turn 虚方法 virt return public
原文地址:http://www.cnblogs.com/TogetherLaugh/p/6667913.html