package methods are final? huh?

Manu via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 2 05:05:00 PDT 2016


On 2 October 2016 at 21:40, rikki cattermole via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 03/10/2016 12:37 AM, Manu via Digitalmars-d wrote:
>>
>> module x.a;
>>
>> class A
>> {
>> package:
>>   int f()
>>   {
>>     return 0;
>>   }
>> }
>>
>>
>> ============================
>> module x.b;
>>
>> import x.a;
>>
>> class B : A
>> {
>> package:
>>   override int f()
>>   {
>>     return 0;
>>   }
>> }
>>
>>> error : function x.b.B.f package method is not virtual and cannot
>>> override
>>
>>
>> Why? I have a UI system with modules for each node type. UI internal
>> stuff is naturally 'package'. Virtuals are perfectly reasonable within
>> a package.
>
>
> I would recommend using the explicit form of package ``package(x):``
> although no idea if that'll help you out here.

It makes no difference. (I actually do use this form).


More information about the Digitalmars-d mailing list