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 17:06:32 PDT 2015


On Thursday, 13 August 2015 at 23:48:08 UTC, Jack Stouffer wrote:
> In my code, the list can have 20-30 different types of classes 
> in it all inheriting from the same interface, and it doesn't 
> make sense for all of those classes to implement a method that 
> is very specific to one of the classes.


I don't want to get too far into this since I haven't seen your 
code, but the function that uses this list might itself be a 
candidate for addition to the interface, or a second interface 
with that method that all the classes also inherit from (remember 
you can only inherit from one class in D, but you can implement 
as many interfaces as you want).


More information about the Digitalmars-d-learn mailing list