ajb@wpi.WPI.EDU (Arthur J. Butler) (09/27/90)
assume i have too classes called Foo and Bar. i can define a conversion operator which will cast a type Bar to type Foo or a type Foo*. can i define a conversion operator to cast a Bar* to a Foo* ??? my thoughts are that i cannot, since the conversion operator takes no arguments. anyone want to show me wrong ?? /* some sample code */ class Foo { ..... }; class Bar { private: Foo *foo_ptr; public: ..... // granted, here we are giving away access to private data!! operator Foo*() { return(foo_ptr); } operator Foo() { return(*foo_ptr); } };