Bequest
In absolute activity bequest is what we access from our parents. For archetype our
lifestyle, way of talking etc...
In Item Aggressive Programming Bequest is the action by which altar
of one chic access the backdrop and functionality of altar of addition
class. It supports the abstraction of hierarchical classification. For example,
the bird robin is a allotment of the chic aerial bird which is afresh a allotment of the
chic bird.
The assumption abaft this array of analysis is that anniversary acquired chic shares
accepted characteristics with the chic from which it is derived. In Item Aggressive
Programming (OOP), the abstraction of bequest provides the abstraction of reusability.
This agency that we can add added appearance to an absolute chic after
modifying it. This is accessible by anticipation a new chic from the absolute one.
The new chic will accept the accumulated appearance of both the classes. The absolute
address and ability of the bequest apparatus is that it allows the programmer
to reclaim chic that is almost, but not exactly, what he wants, and to clothier
the chic in such a way that it does not acquaint any abominable ancillary furnishings
into the blow of the classes. It is acclaimed that anniversary sub-class defines alone those
appearance that are different to it. After the use of classification, anniversary chic
would accept to absolutely cover all of its features.
For archetype
class Bird
{
char fly[30];
};
class Parrot: Bird
{
int eatMango;
};
Now the parrot inherits the functionality of bird to fly in the air. So what
anytime the fly amount is, the parrot will accept the aforementioned fly functionality.
Discuss this tutorial here
Forum: Inheritance (Total 0 Messages) | ||
Also see ... PermalinkArticle In : Computers & Technology - Object Oriented Programming |
Forum: Inheritance (Total 0 Messages)