Show: Object Pascal C++
Display Preferences

E2358 Class constructors not allowed in class helpers (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

A class helper is a method extension for a given class. While you can use class constructors in the main body of your class, class constructors are forbidden to appear in class helpers. The reason is that a class constructor is added to the initialization section at compile time, when the compiler detects that the class is being used somewhere in the code. This cannot be done using class helpers.


{ Define a class }
TMyClass = class
  class constructor Create;                          // OK

{ Define a class helper for the class }
TMyClassHelper = class helper for TMyClass
  procedure myBuilderMethod(AA:Integer; AB:Integer); // OK
  class constructor Create;                          // NOT OK
Personal tools
In other languages