Can we just have struct inheritence already?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Jun 9 21:45:10 UTC 2019


On Sunday, 9 June 2019 at 21:35:19 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 9 June 2019 at 21:13:50 UTC, Manu wrote:
>> This is NOT polymorphism, we're not talking about 
>> polymorphism, I wish people would not change the topic.
>
> Well, it sort of is. Consider a situation where you have 
> assignment defined for the super class, and where there is a 
> field in the subclass that depends on a field in super.

Or rather: you sometimes have a dependency, then you want the 
type system to prevent assignments through the base class. 
However, in other cases you don't have a dependency, then you do 
want to be able to assign through the base class.

But you need something syntactical to tell the type system that 
such dependencies exist.


More information about the Digitalmars-d mailing list