Class TNoParameterlessContructor

Fields
Methods
Properties

Unit

Declaration

type TNoParameterlessContructor = class(TObject)

Description

Descend from this to hide a parameterless constructor.

In Delphi, if you have multiple overloaded constructors (marked with "overload"), the user can call any constructor of the ancestor class that you have not "obscured" by a new definition. In particular, if all your constructors have some parameters, then user can "bypass" them by calling a parameterless constructor defined by TObject. Descend from this class to disallow this. See https://stackoverflow.com/questions/14003153/how-to-hide-the-inherited-tobject-constructor-while-the-class-has-overloaded-one http://andy.jgknet.de/blog/2011/07/hiding-the-tobject-create-constructor/

Note that in FPC (in ObjFpc mode) this is not a problem, as the standard overloading (without the "overload" keyword) is more sane: the overloaded constructors obscure the ancestor constructors.

Hierarchy

  • TObject
  • TNoParameterlessContructor

Generated by PasDoc 0.15.0.