Sarath wrote:
Hello All
Is it possible to overload typeid operator? In my understanding it's
not possible Could you please provide more information on same?
It is not possible. Neither is overloading sizeof, or any of ., .*, ::
or ?:.
All of these operators have important and specific meanings, and would
be severely undermined if users were able to change their meanings.
For typeid, for instance, the whole point is to uniquely identify a
type. If you're trying to make a user-defined type "look" like another
type, you're better off taking advantage of polymorphism and/or
type-conversion (a lá opertor bool(), etc) semantics; typeid is, as it
ought to be, sacrosanct.
--
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/