[fpc-pascal] Class helper properties

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Feb 25 09:29:07 CET 2019


On Sun, 24 Feb 2019 11:03:17 -0500
Ryan Joseph <ryan at thealchemistguild.com> wrote:

> http://wiki.freepascal.org/Helper_types#Usage says class helpers can
> use properties. Why am I getting this error?
> 
> program test;
> 
> type
> 	TMyObject = class
> 		m_num: integer;
> 		property num1: integer read m_num;
> 	end;
> 	THelper = class helper for TMyObject
> 		property num2: integer read m_num;	// ERROR:
> Unknown class field or method identifier "m_num" end;

This is Delphi compatible.
A helper property can only access helper methods.
A property of a class can access helper methods.

pas2js allows both directions.

Mattias



More information about the fpc-pascal mailing list