来大神翻译两个 小代码(一行一行翻译) 急!!急!!
c++吧
全部回复
仅看楼主
level 3
萧炎xy123 楼主
#include <iostream>
using namespace std;
class Father{ public:
void DoWork(){ DriveACar(); }
void DoMannulWork(){ RepairTV(); }
void DriveACar() { cout <<&typeid(*this).name()[6] <<" Drive a car.\n"; }
protected:
void RepairTV() { cout <<&typeid(*this).name()[6] <<" Repair a TV set.\n"; }
};
class Mother{ public:
void SingASong() { cout <<&typeid(*this).name()[6] <<" Sing a song.\n"; }
void DoWork(){ SingASong(); } //正式工
void DoMannulWork() { cout <<&typeid(*this).name()[6] <<" Do mannul work.\n"; } //小工
};
class Boy : public Father, public Mother{ public:
void RepairTV(){ cout <<"boy "; Father::RepairTV(); }
void SingASong(){ cout <<"boy "; Mother::SingASong(); }
void PlayPingPong() { cout <<&typeid(*this).name()[6] <<" Play pingpong.\n"; };
};
void main()
{
Father father;
Mother mother;
Boy boy;
father.DoWork();
mother.DoWork();
mother.DoMannulWork();
boy.PlayPingPong();
boy.DriveACar();
boy.SingASong();
father.DoMannulWork();
boy.RepairTV();
}
2017年10月12日 09点10分 1
level 3
萧炎xy123 楼主
大神 在哪里 快来救救急
2017年10月12日 09点10分 3
level 1
在这里
2017年11月16日 00点11分 4
H活捉小可爱一只!
2017年12月06日 10点12分
level 1
为什么呢
2017年12月06日 10点12分 8
1