How do I find the actual types of the elements in a list of classes?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 13 15:49:13 PDT 2015


On Thursday, 13 August 2015 at 21:42:54 UTC, Jack Stouffer wrote:
> dynamically calling different methods on each object in the 
> list based on its type.

The cleanest OO way of doing that is to put the methods you need 
in the interface and always call it through that. Then there's no 
need to cast and each child class can implement it their own way.


More information about the Digitalmars-d-learn mailing list