[fpc-pascal] [OT] sealed?
Sven Barth
pascaldragon at googlemail.com
Mon Oct 7 20:42:09 CEST 2013
On 07.10.2013 20:38, silvioprog wrote:
> 2013/10/7 Sven Barth <pascaldragon at googlemail.com
> <mailto:pascaldragon at googlemail.com>>
>
> On 07.10.2013 19:29, silvioprog wrote:
>
> Hello,
>
> I was surfing the internet and came across this structure Delphi:
>
>
> TJSONPair= class sealed(TJSONAncestor)
>
>
> So, what is this?
>
>
> Simple: You are not allowed to create child classes of sealed
> classes (the compiler enforces this). FPC supports this since 2.4.2.
>
> Regards,
> Sven
>
>
> Perfect!
>
> It tested it:
>
> TBaseClass = class
> end;
>
> TOtherClass = class sealed(TBaseClass)
> end;
>
> TFooClass = class(TOtherClass)
> end;
>
> and:
>
> unit1.pas(24,32) Error: Cannot create a descendant of the sealed class
> "TOtherClass"
>
> It is wonderful, thank you very much Sven! :)
Well, the opinion whether this feature is wonderful or not differs among
FPC/Delphi users :P
Regards,
Sven
More information about the fpc-pascal
mailing list