用组合就可以呀,如下所示:
class A
{
public:
int CalcZhouChang()
{
...
}
int CalcDiMianJi()
{
...
}
};
class B
{
public:
int CalcBiaoMianJi()
{
return m_a.CalcDiMianJi() * m_a.CalcZhouChang();
}
private:
Am_a;
};
用组合就可以呀,如下所示:
class A
{
public:
int CalcZhouChang()
{
...
}
int CalcDiMianJi()
{
...
}
};
class B
{
public:
int CalcBiaoMianJi()
{
return m_a.CalcDiMianJi() * m_a.CalcZhouChang();
}
private:
Am_a;
};