类的设计

来源:互联网 发布:慕课网 java视频教材 编辑:程序博客网 时间:2024/04/30 17:49

class A

{

public:

      bool getvalue();

public:

    int m_value;

}

bool A::getvalue()

{

   m_value = 1 + 1;

    return true;

}

class B

{

public:

    int getvalue();

private:

    bool setvalue();

private:

    int m_value;

}

int B::getvalue()

{

       return m_value;

}

bool B::setvalue()

{

    m_value = 1 + 1;

    return true;

}

 

class C

{

public:

    bool setvalue();

     int getvalue();

private:

    int m_value;

}

 

int C::getvalue()

{

       return m_value;

}

void fun(int *value)

{

    *value = 1 + 1;   

}

bool C::setvalue()

{

    fun(m_value);

    return true;

}

原创粉丝点击