What is the function of Inheritance in Delphi?

What is the function of Inheritance in Delphi?



- Inheritance is a method to inherit the properties of the parent’s class by the child class.

- Inheritance is used in Object oriented language and it deals with the real world objects and information.

- The data in these scenarios is treated as an object and it has the characteristics like size and the actions that are performed on them.

- In inheritance a class is dependent on another object. The child object inherits the properties of the parent’s class and uses it.

- Child class has its own features but it also inherits the properties or the features from the parent’s class.

- The example shows it
type
TBall = class
protected
ballSize : Byte;
published
procedure Kick(power : Byte);
function GetSpeed : Byte;
constructor Create(size : Byte);
end;

TFootball = class(TBall)
private
ballPanels : Byte;
published
constructor Create(size : Byte; panels : Byte);
end;
Post your comment