But the benefits of the objects do not stop there they also have .
objects the special ability to inherit functionality from other objects .
Here is a metaphor considering the cat as a bojeto :
A cat is a cat. Since this is a cat, we know that it has properties including mustaches, retractable claws and sharp teeth. We also know that the methods that have included the fact that purrs when he is happy that hunting mice, and tears up the sofa when it is sharpening its claws .
But a cat is a cat. It is also a mammal. As a mammal, which inherits certain attributes shared by all mammals. For example, mammary glands, is warm-blooded, which gestates its young inmates, who breathes, maintains homeostasis, etc. …
When you think about the inheritance and property, it is helpful to distinguish between a “is a “Relationship and” has a “relationship because objects can have both types of relationships with other .
For example, although one can say a cat is an object of mammals, and have an object called the brain, not You can say a cat has a subject and an object mammalian brain .
With the inheritance, if you find someone who has already developed an object that is “above all” what you need, you can easily add new features without breaking the old ones, or even having to understand how the old work .
In other words, inheritance allows you to easily reuse the code.