Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!ukma!psuvax1!swatsun!gessel From: gessel@cs.swarthmore.edu (Daniel Mark Gessel) Newsgroups: comp.lang.c++ Subject: Overloading typecast Summary: Can one overload typecasting of pointers. Keywords: overloading operators typecasting Message-ID: Date: 25 Jun 91 14:08:45 GMT Organization: Swarthmore College, PA, USA Lines: 23 I have seen: class X { public: overload char *() } meaning overload the (char *) operator so that (char *)X can be meaningful. I would like to overload the casting of a pointer to another pointer, in user defined classes. I'm doing memory management and need to cast a pointer to an abstract class object to a non-abstract subclass. If I can get control of the casting operator, I can check a flag in the object itself. Anybody know if it's available in C++ 2.0? (in particular Borland C++) I saw it in an old C++ book. G++ seems to support it for the (char *) example above, I just can't figure how to get it to typecast for pointers). Any help much appreciated, Dan -- Daniel Mark Gessel Internet: gessel@cs.swarthmore.edu