Get which derived class an object is if it's stored in an array of its base class

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 15 06:12:49 PDT 2017


On Saturday, 15 July 2017 at 13:02:52 UTC, Morimur55 wrote:
> is there a way to check without attempting to cast to every 
> derived type?

The `typeid(obj)` will give the type... but why do you need it? 
The classinfo returned by that doesn't give a lot of info.

Casting is how you actually get the object, though you might be 
better off putting the necessary methods in the base class.


More information about the Digitalmars-d-learn mailing list