On Mon, 5 Jun 2006, Al Boldi wrote:
> > > > A useful shorthand for A.Free; A := nil; is FreeAndNil(A); > > Similarly, A.Free; is a shorthand for if A<>nil then A.Destroy; > > > > As the example shows, the programmer has to take care that once a object > > is freed, none of the pointers to it are used! If more that one variable > > points to the same object instance, this is indeed not so easy. > > > > Note that unlike e.g. many scripting languages, Pascal has no automatic > > memory management. > > Thanks for the detailed explanation! > > So to ensure a valid self inside the instance method, it should be virtual? No. The compiler cannot ensure this, not ever. You must only make a method Virtual if you know you will override it in descendent objects. > If so, what side-effects would this cause when applied across the complete > class-hierarchy? Blow up the size of you executable. > > And is there a switch to pass to FPC to make all methods virtual? No. It would make no sense. It only blows up your executable. Michael. _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives