On Saturday, 15 July 2017 at 13:12:49 UTC, Adam D. Ruppe wrote:
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.
Well I want to cast to the derived type so I can use a method
that's defined in the base class, but is overridden in several of
the derived types... and calling it without a cast seems to give
me the base type functionality, but I'd like the derived type
functionality when it's defined.
I have a lot of derived types, some of which may be added in
future by someone else... was hoping something like
`cast(typeid(obj))` was going to work... but my compiler doesn't
like that :(