Composition offers better test-ability of a class than Inheritance . If one class consists of another class, you can easily construct a Mock Object representing a composed class for the sake of testing. This privilege is not given by inheritance.
Why is composition better than inheritance?
Composition offers better test-ability of a class than Inheritance . If one class consists of another class, you can easily construct a Mock Object representing a composed class for the sake of testing. This privilege is not given by inheritance.