[fpc-pascal]Classes/Objects/Pointers / Pointer Help
memsom at interalpha.co.uk
Mon Feb 10 14:29:17 CET 2003
This is where Classes are better than objects... This will only work if
you don't reference any thing that is instantiated by the constructor,
i.e. all Methods and fields.
> type TmyObject = object
> procedure test;
TMyClass = class
class procedure test;
> procedure TmyObject.test;
As is, but add 'class' prefix..
> procedure main;
> MyObject: TmyObject;
What you want is garbage collection, not a lack of
constructors/destructors... What you will get is VBPascal. Nasty.
You could try:
IMyClass = interface
TMyClass = class(TInterfacedObject, IMyClass)
class function Get(): TMyClass;
Class function TMyClass.Get() : IMyClass;
result := TMyClass.Create;
Though this is quite nasty in itself too.
More information about the fpc-pascal