博客來網路書店查詢

書名

博客來網路書店查詢

星期六, 5月 21, 2016

人類繼承觀念內的子類別部分

class son1:public father1
{
public:
      float money;
    son1( )
    {
        money=father1::money*0.6;
        father1::money=father1::money- money;
        cout << "son1 father1 money="<        cout << "son1  money="<    }
};
class son2:public father1
{
public:
      float money;
    son2( )
    {
        cout << "son2 father1 money="<        money=father1::money*0.4;
    }
};
class grandson:public son1
{
public:
    float money;
    grandson( )
    {
        cout << "grandson father1 money="<        money=son1::money*0.6;
        son1::money=son1::money-money;
        cout << "grandson  money="<< money<< endl;
        cout << "grandson son1 money="<< son1::money<< endl;
    }
};

沒有留言: