[fpc-pascal] Published -> Public

Zaher Dirkey parmaja at gmail.com
Fri Apr 16 08:42:32 CEST 2010


What useful for put procedure in Publish?

On Fri, Apr 16, 2010 at 12:06 AM, José Mejuto <joshyfun at gmail.com> wrote:
> 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é
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Zaher Dirkey



More information about the fpc-pascal mailing list