#ifndef BASEH #define BASEH #include using namespace std; class base { int i; protected: virtual void print(ostream& os) const {os << i;} public: base(int initial_i): i(initial_i) {} virtual ~base() {} friend ostream& operator<<(ostream& ost, const base& b) { b.print(ost); return ost; } }; #endif