#include#include using namespace std; class MM { public: MM(string name, int money) : name(name), money(money) {} void printsrc() { cout << name << 't' << money << endl; } protected: string name; int money; }; class Boy : public MM { public: Boy(string name, int money, string boyName) :MM(name, money) { this->boyName = boyName; } void print() { cout << boyName << 't' << name << 't' << money << endl; } protected: string boyName; }; class Girl :public Boy { public: Girl(string name, int money, string boyName, string girlName) :Boy(name, money, boyName) { this->girlName = girlName; } void printGirl() { cout << girlName << endl; } protected: string girlName; }; int main(int argc, const char* argv[]) { Boy b1("hehe", 1, "hehe2"); b1.print(); b1.printsrc(); Girl g1("meimei", 2, "me", "meimei21"); g1.printGirl(); g1.print(); while (true); return 0; }



