Constructor inheritance? Why not?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 7 20:35:51 PDT 2015


On Monday, 8 June 2015 at 02:39:22 UTC, Tofu Ninja wrote:
> Is there any reason why constructors are not inherited? All 
> other methods are inherited, why not constructors?

They're not polymorphic, and it doesn't make sense to call a base 
class constructor on a derived class. I think that I heard 
somewhere that C++11 added some sort of constructor inheritance, 
so maybe there's something we could do that would make sense, but 
in general, I don't see how the concept makes any sense at all. 
Construction is intimately tied to the type being constructed. 
It's as non-generic as you can get.

- Jonathan M Davis


More information about the Digitalmars-d mailing list