BZ易风

导航

 

 

#include <iostream>
using namespace std;

class Cube
{
public:
    void SetL(int l)
    {
        m_L = l;
    }

    int GetL() const   //只有用const修饰的方法,compareCube才能用const做形参
    {                //如果没有const 修饰,就没法保证成员函数里是否修改了成员属性
        return m_L;
    }

private:
    int m_L; //
    int m_W; //
    int m_H; //
}

bool compareCube(const Cube &cub1,const Cube & cub2) 
{
    return cub1.GetL() == cub2.GetL()
}

int main()
{

}

 

posted on 2021-08-19 16:30  BZ易风  阅读(34)  评论(0编辑  收藏  举报