Could you please remind me if Objects support polymorphism?

Could you please remind me if Objects support polymorphism?

For instance, I can not compile the following code:

  TObj1 = object
    procedure DoWork; virtual;
  end;

  TObj2 = object(TObj1)
    procedure DoWork; override;
  end;

[Error] Unit1.pas(15): Declaration of 'DoWork' differs from previous declaration
[Error] Unit1.pas(15): Field definition not allowed after methods or properties
[Error] Unit1.pas(16): Type expected but 'END' found

Comments