[fpc-pascal] virtual class var?
Andrew Haines
AndrewD207 at aol.com
Tue Aug 7 02:18:36 CEST 2012
Hi, is it possible to have a virtual class variable? I want to have a
pointer available per class that can be a different value.
Something like this:
TA = class
class var Foo: TObject; virtual;
end;
TB = class(TA)
class var Foo: TSpecialObject; override;
end;
I have in mind multiple levels of inheritance. I am storing a vmt like
record/object in the variable, so the variable the child class overrides
will be compatible with the ancestor class. It's possible there may be
many instances of the objects so I do not want to create an variable per
instance if I can help it.
Regards,
Andrew
More information about the fpc-pascal
mailing list