public:
virtual void input() = 0;
virtual void print() = 0;
shape(){};
virtual ~shape(){};
};
#endif
【说明】定义一个抽象基类,有两个行为,input()为输入图形参数,print()为打印图形参数。图省事,只是简单的说明问题而已。
#ifndef point_h
#define point_h
class point
{
public:
void put()
{
cout << "x坐标为:";
cin >> x;
cout << "y坐标为:";
cin >> y;
}