So, I have two classes:
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;
}
My question is, how can i call the friend function of the base class from the child class to output its content:
output<<n.second<<Base:: ????<<endl
Thanks in advance :)
output<<n.second<<static_cast<const Base&>(n)<<endl;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With