D ! Have fun !
#include <iostream>
class Base
{
protected :
int x;
public :
friend std::istream &operator >>( std::istream &is, Base &b )
{
is >> b.x;
return is;
}
};
class Derived : public Base
{
private :
int y;
public :
friend std::istream &operator >>( std::istream &is, Derived &d )
{
is >> static_cast< Base & >( d );
is >> d.y;
return is;
}
};
int main()
{
Derived d;
std::cin >> d;
return 0;
}
No comments:
Post a Comment