Difference between revisions of "Reintroduce"

From Lazarus wiki
Jump to navigationJump to search
m
Line 7: Line 7:
 
Example:
 
Example:
  
  procedure setTest(strName: String); reintroduce; //This replaces the method of the parent class in the derived class
+
  procedure setTest(strName: String); reintroduce; // This replaces the method of the parent class in the derived class

Revision as of 18:35, 24 July 2018

Deutsch (de) English (en) Esperanto (eo) suomi (fi) français (fr)

The modifier reintroduce belongs to object-oriented programming. The modifier reintroduce allows a method of the parent class to be concealed by a new method with the same name. That is, a new method exists in the class derived from the parent class and in all other classes derived from it. The method in the parent class is preserved and can still be used by it.

The method of the parent class does not exist anymore in the new class, it has been replaced by the new method with the same name. The method continues to exist in its original form in the parent class and can be used through the parent class.

Example:

procedure setTest(strName: String); reintroduce; // This replaces the method of the parent class in the derived class