Inheritance
Similar, but just a little bit different.
The world is full of exceptions and similarities.
Object Orientation places everything perfectly in a class tree.
- Both waiter and cook are employee.
So they both have an employee number.
This generic employee number gets a generic place in Employee.
- Both return a cup of coffee to the question "A cup of Coffee please".
That similar behavior also gets a generic place in Employee.
- There are some exceptions.
Waiter and Cook have different methods to get a cup of coffee.
Those specific methods get a specific place, reusing the more generic part in Employee.
No matter how complex your business situation is, Object Orientation can cope with it.
|
|