#include <iostream>
using namespace std;
class Person {
public:
void sing();
};
class Child : public Person {
public:
void sing();
};
Person::sing() {
cout << "Raindrops keep falling on my head..." << endl;
}
Child::sing() {
cout << "London bridge is falling down..." << endl;
}
int main() {
Child suzie;
suzie.sing(); // I want to know how I can call the Person's method of sing here!
return 0;
}
最佳答案
suzie.Person::sing();
关于c++ - 子类如何使用与子类相同的方法名调用父类(super class)的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6287186/