Answer»
- 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; 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;
|