Vote count:
0
Why does var2->m4(); cause a compile error. Sorry for the indentation. This was a class example so a conceptual answer would be the most helpful. Please ignore this>>>whi si a;lkf ;alsikduofj lskadjf ;laksjdf;lkasj d;lfkj as;ldkfj asl; kd jf;lkasdjf;lkasj d;flk jasd;lkfj ;l kasjflk asjg liksdh'iuyhgfasdkjfugka uhyfbaks ydfbakis yuod fbasdgh'bnmfkusdbfuishasdbfuyhasdufyhbasuodfyhbasyudfb a yuosd fb uasdbnf asdl fukhaskdfhalsiudhf lasidfl
class Tongue : public Mouth {
public:
virtual void m1() {
cout << "T 1" << endl;
Mouth::m1();
}
void m3() {
cout << "T 3" << endl;
}
};
class Nose : public Tongue {
public:
virtual void m1() {
cout << "N 1" << endl;
}
virtual void m2() {
Tongue::m2();
cout << "N 2" << endl;
}
void m3() {
cout << "N 3" << endl;
}
};
class Mouth {
public:
virtual void m1() {
cout << "M 1" << endl;
}
virtual void m2() {
cout << "M 2" << endl;
m1();
}
};
class Ear : public Tongue {
public:
virtual void m2() {
m1();
m1();
}
virtual void m4() {
cout << "E 4" << endl;
}
}
asked 36 secs ago
Aucun commentaire:
Enregistrer un commentaire