Talk about the disturbance of the rookie

zhaozj2021-02-11  212

The function overload is different, and the example expression of the function overload is as follows: Function foo (i: integer): string; overload; function foo (s: string): string; overload; pass different parameters, Select Perform different functions.

The polymorphism is to give the child object to the parent class object (big inverse?! :)), let the parent class object have a sub-object method, an example expression is as follows: tparent = class (TOBJECT) Procedure Draw; Virtual; End ;

TCHILD = Class (Tparent) Procedure Draw; Override; Virtual;

Parent: = CHILD;

Parent.draw; // Execute subclass DRAW;

That is why we always see the parameters of Sender: Tobject, which is the result of assigning subclass objects such as 1 Button to the Parent class (TOBJECT)

转载请注明原文地址:https://www.9cbs.com/read-5233.html

New Post(0)