Overriding abstract class fields
slaid via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 1 05:00:37 PDT 2016
On Thursday, 1 September 2016 at 11:34:28 UTC, Basile B. wrote:
> On Thursday, 1 September 2016 at 11:09:18 UTC, slaid wrote:
>> I have a snippet:
>>
>> How do I override this height field?
>>
>> Thanks
>
> The field height is not overridden. In C you have two "height".
> Since your array is of type A[], map takes A.height.
>
> Only methods are virtual. To solve the problem you can create a
> virtual getter:
>
> But since height is only a field you can just use the same
> variable and set the value in the constructor (for example)
Just what I needed, thanks a bunch!
More information about the Digitalmars-d-learn
mailing list