Why not finally allow bracket-less top-level keywords?

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Mon Mar 19 06:38:12 PDT 2012


Having a final class is conceptually different from having a class
with only final methods. You can legitimately inherit from a class
with no virtual methods and add to its interface and implement other
methods using its final ones. The final class concept is extremely
useful when you just don't want to be inherited from. For instance,
Your class may be closely tied to an implementation and inheriting
from it would wreck the implementation.

On Mon, Mar 19, 2012 at 2:04 PM, deadalnix <deadalnix at gmail.com> wrote:
> Le 18/03/2012 18:06, Simen Kjærås a écrit :
>>
>> On Sun, 18 Mar 2012 18:07:10 +0100, deadalnix <deadalnix at gmail.com> wrote:
>>
>>> Le 18/03/2012 17:49, Timon Gehr a écrit :
>>>>
>>>> On 03/18/2012 05:25 PM, FeepingCreature wrote:
>>>>>
>>>>>
>>>>> Advantages: internally consistent, no need for completely new syntax,
>>>>> "final class" can be deprecated (it never worked well anyway).
>>>>>
>>>>
>>>> final class means that the class cannot be inherited from.
>>>
>>>
>>> What is the point to inherit is no virtual method exists ?
>>
>>
>> Access to protected members.
>
>
> That is a reason, but I never saw that except for dirty hacks :D



-- 
Bye,
Gor Gyolchanyan.


More information about the Digitalmars-d mailing list