I have the interface:
IColored that guarantees the function getColor.
Now I have two objects:
1. Ferrari
2. RedApple
that both implement this interface/function in the same way.
(But cannot inherit from the same object - no multi-inheritance allowed).
How would you avoid code-duplication?
I guess what you are looking for is object aggregation.
Check out TAggregatedObject
. The idea is to have an object that implements
the behavior and as a property it delegates the interface functions to that
inner object.