Hi.

I would like to know is it possible to apply polymorphism to overloaded operators? For examples, is it possible to rely on polymorphism via creating virtual overloaded operators and friend functions?

Consider the ostream and istream for instance. I would like to design a hierarchy such as this.

Code:
Base *pB;
Derived *pD = Derived();
pB = dynamic_cast<Base *>(pD);

// I would like this line to call an ostream friend function in the *Derived* class.

cout << pB;
My code might be off. Nonetheless, the point I want to get at is applying polymorphism to overloaded functions and friend functions, especially iostream.

Thanks,
Kuphryn