Allow property getters to expose object fields as one of its base/parent types
Original Reporter info from Mantis: Bad Sector @badsectoracula
-
Reporter name: Kostas Michalopoulos
Original Reporter info from Mantis: Bad Sector @badsectoracula
- Reporter name: Kostas Michalopoulos
Description:
This patch adds a new feature that enables property getters to expose objects as one of its base/parent types. As an example:
===
program ExposeDerivedAsBase;
{$mode objfpc}
type
TBase = class
end;
TDerived = class(TBase)
end;
TSomething = class
private
FProp: TDerived;
public
property Prop: TBase read FProp;
end;
begin
end.
===
This can be useful when you want to access the property varfield directly to avoid any additional overhead while hiding the actual internal object type that the object uses. See the message in fpc-devel list for details.
Mantis conversion info:
- Mantis ID: 37175
- Version: 3.3.1
- Monitored by: » Vincent (Vincent Snijders), » AntonK (Anton Kavalenka)