Reimar Grabowski schrieb:
On Tue, 17 Apr 2012 22:19:45 +0200
Sven Barth <[email protected]> wrote:

type
   TMyHackImage = class(TImage)
   public
     function DestRect: TRect;
   end;

var
   MyImage: TImage;
   r: TRect;
begin
   // let's suppose that MyImage contains a TImage instance
   r := TMyHackImage(MyImage).DestRect
end;
How should that work?
What does the DestRec function look like?

You're right, above code should not work. The DestRect function has to be omitted from above declaration, so that the DestRect of the base class is used.

The elevation of visibility only works for *properties*, i.e.
  public
    property DestRect;
should work. But often (depending on the compiler) the mere declaration of an empty derived class allows to access protected members of the base class.

DoDi


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to