getting type of object

0ffh spam at frankhirsch.net
Sun Nov 11 12:40:16 PST 2007


Hi,

if I have an object of class Foo, or a subclass of Foo, like:

   Foo foo=someInstanceOfFooOrItsSubclasses();

Is there a more elegant method to get the type of the object
than adding a member function to Foo and all its subclasses
that does something like:

   TypeInfo getType()
   {
     return typeid(typeof(this));
   }

?

Regards, Frank


More information about the Digitalmars-d-learn mailing list