Old-style "object" types still exist, and even support inheritance, visibility modifiers and virtual/overrides.
Here an example :
type BaseType = object
protected
FValue: Integer;
public
procedure Initialize(const aValue: Integer); virtual;
end;
type ExtensionType = object(BaseType)
private
FExtra: Integer;
public
procedure Initialize(const aValue: Integer); override;
end;
You do need to be aware of a few facts about this :
- support for this might be dropped in the future (it's been deprecated since Delphi 3, although you can still use this in Delphi 2009)
- just like records, instances of these types are stack-allocated
- unlike records, "object" instances are not finalized
That being said, I do think it's an nice alternative to records (which don't support inheritance), and classes (which aren't stack-managed).