Struct Inheritance maybe possible?

Heyo,

I am wondering, would it be theoretically possible to implement inheritance for structs?

like:

type
  TBase = record
    public
       A: integer;
       B: char;

      method MyAbstractMethod; abstract;
  end;

 TSub = record(TBase);
    public
       C: string[10];
     
    method MyAbstractMethod; override;
    begin
       writeln('I WAS OVERRIDEN!!');
    end;
 end;

Would supercool to find out :slight_smile:

cheers

I believe we added support for this a while back?

But does Method/Property inheritance also work, those are important too, cause structs cannot have VMT or atleast they do not have one.

You’re right. field inheritance does work. method overriding and virtuality won’t and can’t work, because as you say,

1 Like