[fpc-pascal] Published -> Public

José Mejuto joshyfun at gmail.com
Fri Apr 16 00:06:37 CEST 2010


Hello FPC-Pascal,

Thursday, April 15, 2010, 11:57:01 PM, you wrote:

>> TMyClassPublished=class(TObject)
>> published
>>   procedure MyProcedure; virtual;
>> end;
>> And a derived one:
>> TMyClassDerived=class(TMyClassPublished)
>> public
>>   procedure MyProcedure; override;
>> end;
>> Is there any difference in the derived one with less visibility in the
>> method ? This means, does it use less/more memory, more/less calling
>> speed, more/less RTTI information, ... ?
MW> no, no, no, no
MW> You cannot lower visibility, since the following example is still possible:
MW> var
MW>    a:TMyClassPublished;
MW> begin
MW>    a := TMyClassDerived.Create;
MW>    a.MyProcedure;
MW> end;
MW> it will use the scope of a and not the "redefined" scope in TMyClassDerived

That was exactly my suspect, but as RTTI was in the game, maybe some
differences happend.

I had found this "visibility lower" warnings all along the LCLfpgui
interface, so I think I will move them to the expected "published"
level as parent TWSxxx classes.

-- 
Best regards,
 José




More information about the fpc-pascal mailing list