[fpc-pascal] [OT] sealed?

silvioprog silvioprog at gmail.com
Mon Oct 7 20:53:18 CEST 2013


2013/10/7 Sven Barth <pascaldragon at googlemail.com>

> On 07.10.2013 20:38, silvioprog wrote:
>
>> 2013/10/7 Sven Barth <pascaldragon at googlemail.com
>> <mailto:pascaldragon@**googlemail.com <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
>

:D

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131007/06af4be1/attachment.html>


More information about the fpc-pascal mailing list