[fpc-pascal] methods of an object to create others objects

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jul 6 18:58:57 CEST 2010


On 06 Jul 2010, at 18:42, Andrew Brunner wrote:

> Double Nope.  You cannot access methods of a nil object.

You can, as long as such methods are not virtual (and "free" is not a virtual method).

> Nil.Free
> will in-it-and-of-it cause a read access violation.

This is what free does:

           if self<>nil then
             self.destroy;

So it will work fine when called on "nil".


Jonas


More information about the fpc-pascal mailing list