Way way back this is how IUnknown was defined before Delphi added the interface language feature:
IUnknown = class public { IUnknown } function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall; abstract; function _AddRef: Integer; virtual; stdcall; abstract; function _Release: Integer; virtual; stdcall; abstract; end;
Here's IUnknown now:
IUnknown = interface ['{00000000-0000-0000-C000-000000000046}'] function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall; function _AddRef: Integer; stdcall; function _Release: Integer; stdcall; end;
There are so many advantages it's hard to list them all and now we just take them for granted, but here are a few advantages:
- implement multiple interfaces on the same object
- compiler support for lifetime management
- assign an interface to a GUID