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

deadalnix deadalnix at gmail.com
Mon Mar 19 09:26:01 PDT 2012


Le 19/03/2012 14:38, Gor Gyolchanyan a écrit :
> 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.
>

It looks like a bad usage of inheritance. If you want to use these 
methods, why not use composition ?

It make no sense to use such an inherited class in a polymorphic 
context, so why use inheritance at all ?


More information about the Digitalmars-d mailing list