Problem 1467. -- 继承派生(6)--二维坐标和三位坐标系类

1467: 继承派生(6)--二维坐标和三位坐标系类

Time Limit: 10 Sec  Memory Limit: 65535 MB   64bit IO Format: %lld
Submitted: 442  Accepted: 359
[Submit][Status][Web Board]

Description

二维坐标系的点类Point包含私有成员数据横纵坐标值x和y,均为int类型。Point类包含若干成员函数(如下所示)。
class Point
{
    private:
        int x,y;
    public:
        Point();
        Point(int xx,int yy);
        void Show();
        int GetX();
        int GetY();
};
三维坐标类Three_dimensional由Point类公有派生而来,包含私有成员数据z轴上的坐标值(int z)。Three_dimensional类包含若干成员函数(如下所示)。
class Three_dimensional:public Point
{
    private:
        int z;
    public:
        Three_dimensional();
        Three_dimensional(int x,int y,int r);
        Three_dimensional(Point p,int r);
        Three_dimensional(int r);
        Three_dimensional(Point p);
        void Show();
};
完成上述各成员函数的设计。main函数已给定(如下所示),提交时只需要提交main函数外的代码部分。
int main()
{
    int x,y,z;
    int cas=0;
    Point p0;
    Three_dimensional t0;
    cout<<"Point 0: "; p0.Show();
    cout<<"Three_dimensional0: ";  t0.Show();
    while(cin>>x>>y>>z)
    {
        cas++;
        cout<<"Case #"<<cas<<":"<<endl;
        Point p1(x,y);
        Three_dimensional t1(x,y,z);
        Three_dimensional t2(p1,z);
        Three_dimensional t3(z);
        Three_dimensional t4(p1);
        cout<<"Point 1: "; p1.Show();
        cout<<"Three_dimensional1: "; t1.Show();
        cout<<"Three_dimensional3: "; t2.Show();
        cout<<"Three_dimensional3: "; t3.Show();
        cout<<"Three_dimensional4: "; t4.Show();
    }
    return 0;
}

Input

包含多组数据(数据均正确合法)
每组测试数据1行,包含3个整数。

Output

每组测试数据输出具体格式详见Sample Output。

Sample Input

1 2 3

Sample Output

Function #1 is called!
Function #1 is called!
Function #4 is called!
Point 0: (0,0)
Function #3 is called!
Three_dimensional0: (0,0,0)
Function #9 is called!
Case #1:
Function #2 is called!
Function #2 is called!
Function #5 is called!
Function #6 is called!
Function #2 is called!
Function #7 is called!
Function #8 is called!
Point 1: (1,2)
Function #3 is called!
Three_dimensional1: (1,2,3)
Function #9 is called!
Three_dimensional3: (1,2,3)
Function #9 is called!
Three_dimensional3: (100,100,3)
Function #9 is called!
Three_dimensional4: (1,2,10)
Function #9 is called!

[Submit][Status][Web Board]