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

2017-07-15 Thread Morimur55 via Digitalmars-d-learn
On Saturday, 15 July 2017 at 14:46:17 UTC, Adam D. Ruppe wrote: On Saturday, 15 July 2017 at 14:36:40 UTC, Morimur55 wrote: ...let me try that again without accidentally sending it before I'd finished... tab on the web interface is so useful... but so annoying sometimes too. ...and I think

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

2017-07-15 Thread Morimur55 via Digitalmars-d-learn
On Saturday, 15 July 2017 at 14:26:30 UTC, Morimur55 wrote: On Saturday, 15 July 2017 at 14:04:17 UTC, Adam D. Ruppe wrote: On Saturday, 15 July 2017 at 13:45:40 UTC, Morimur55 wrote: Well I want to cast to the derived type so I can use a method that's defined in the base class, but is overridd

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

2017-07-15 Thread Morimur55 via Digitalmars-d-learn
On Saturday, 15 July 2017 at 14:04:17 UTC, Adam D. Ruppe wrote: On Saturday, 15 July 2017 at 13:45:40 UTC, Morimur55 wrote: 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

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

2017-07-15 Thread Morimur55 via Digitalmars-d-learn
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

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

2017-07-15 Thread Morimur55 via Digitalmars-d-learn
I've got a bunch of different classes all derived from the same base class sitting in a base[]. I need to check what the derived types are of these objects - is there a way to check without attempting to cast to every derived type?