现在的位置: 首页 > 综合 > 正文

第十二周 项目1 . 3

2014年09月05日 ⁄ 综合 ⁄ 共 462字 ⁄ 字号 评论关闭
#include <iostream>
using namespace std;
class Animal
{
public:
    Animal() {}
    void eat()
    {
        cout << "eat\n";
    }
protected:
    void play()
    {
        cout << "play\n";
    }
private:
    void drink()
    {
        cout << "drink\n";
    }
};
class Giraffe: protected Animal
{
public:
    Giraffe() {}
    void StrechNeck()
    {
        cout << "Strech neck \n";
    }
    void take()
    {
        eat();    // _______________
        //drink();  // _______________
        //play();   // _______________
    }
};
int main()
{
    Giraffe gir;
    //gir.eat();   // _______________
    //gir.play();  // _______________
    //gir.drink(); // _______________
    return 0;
}

抱歉!评论已关闭.