Is there a reason for this:

class TBase
  FBar: TObject;
end;

class TChild(TBase)
  function GetBar: TChildObject; // does just a typecast

  // provide a property Bar to avoid type-casts
  property Bar: TChildObject
    read GetBar
    write FBar; // this doesn't work
end;


I understand there is a rule for property and variable type to match exactly...

But in the above case that rule would not be needed?
Since FBar: TOBject is a base class of TChildObject, it can store any object that can be assigned to Bar.

Martin
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to