Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2024-05

class property - should this work - static field in nested field

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Frb

The below fails to compile.

However "b" is a class var. The fact that it is reached via a normal field, does not change that. The address/value of TBar.f.b can be known without on instance of TBar required.

Mind, this is a theoretical question, I don't actually need it, just came across the idea and wanted to know.

program Project1;
type
   TFoo = object
     a: integer;
     class var b: integer;
   end;

  TBar = class
    f: TFoo;
    class property fb: integer read f.b;   // Error: Illegal symbol for property access
  end;

begin
end.

Reply by email