|
-
September 13th, 2002, 08:41 PM
#1
Polymorphism & Overloaded Operators :: C++
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|