所以,我有两个课程:
class Base {
private:
int number;
public:
friend ostream & operator<<(ostream & output, const Base &n);
}
ostream & operator<<(ostream & output, const Base &n) {
output<<n.a<<endl;
return output;
}
class Child : Base {
private:
int second;
public:
friend ostream & operator<<(ostream & output, const Child &n);
}
ostream & output<<(ostream & output, const Child &n) {
output<<n.second<<Base:: ????<<endl;
return output;
}
我的问题是,如何从子类调用基类的友元函数来输出其内容:
output<<n.second<<Base:: ????<<endl
提前致谢 :)