In our previous episode, Ryan Joseph said: > > See http://freepascal.org/docs-html/current/ref/refse48.html#x101-1230007.7 > > for an example. > > > > See also http://wiki.freepascal.org/How_To_Use_Interfaces > > "All COM interfaces use reference counting. This means that whenever an > interface is assigned to a variable, it?s reference count is updated. > Whenever the variable goes out of scope, the reference count is automatically > decreased. When the reference count reaches zero, usually the instance of the > class that implements the interface, is freed.? > > Shouldn?t destroy be called in this example when TestScope exists?
No, since you don't declare an interface variable, but a class variable. There are a zillion Delphi faqs about this, but the crux is to use var scope:IInterface; And reference counting as garbage collection method has been discussed to dead on various maillists and forums. Both Delphi and Lazarus/FPC. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal