[fpc-devel] Re: RFC: Delphi style class helpers

Paul Ishenin ip at kmiac.ru
Wed Dec 22 10:00:47 CET 2010


22.12.2010 15:00, Sven Barth wrote:

> Would you please test the following:
> - identifier visibility if class helper and extended class reside in
> different units (because I can't believe that a helper can access
> private members while a derived class can't)

Class helper can access the same as derived class

> - can overloaded methods be defined? (e.g. class contains "Test(a:
> String);" and helper contains "Test(a: Integer);")

If overload is used then yes, if not then no. Look at test for more info.

> - what happens if you define a method in the helper that has the same
> name as a virtual method in the extended class (without "override" of
> course ^^)

Look at test.

> - is a class helper method used in a derived class if the derived class
> does not contain a method with the same name?

Look at test.

> - class helper and class in two different units, both containing a
> method with the same name. which method get's called if the unit with
> the class is used before the unit with the class helper in the main
> program?

Will test later.

> - can class helpers have fields and if so is their value saved somehow?

They can't.

> - can class helpers extend interfaces?

How you see this?

> - can a class helper reintroduce a virtual method from the extended class?

Yes.

Best regards,
Paul Ishenin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tclasshelper2.dpr
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101222/e210293f/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tuclasshelper1.pas
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101222/e210293f/attachment-0001.ksh>


More information about the fpc-devel mailing list