[fpc-pascal] Published -> Public
Marc Weustink
marc at dommelstein.net
Thu Apr 15 23:57:01 CEST 2010
José Mejuto wrote:
> Hello FPC-Pascal,
>
> If I have a class like:
>
> 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, ... ?
no, no, no, no
You cannot lower visibility, since the following example is still possible:
var
a:TMyClassPublished;
begin
a := TMyClassDerived.Create;
a.MyProcedure;
end;
it will use the scope of a and not the "redefined" scope in TMyClassDerived
Marc
More information about the fpc-pascal
mailing list