Is it possible to store different subclasses in one array?

Adam D. Ruppe destructionator at gmail.com
Mon Apr 13 01:47:11 UTC 2020


On Monday, 13 April 2020 at 01:42:51 UTC, Leonardo wrote:
> Is it possible to store different subclasses in one array?
> In C#, we have this example, but how I do that in D?

Did you try

BaseItem[] GameItems;
GameItems ~= new Weapon();


yet?


More information about the Digitalmars-d-learn mailing list