TIJ chapter 7: Reusing Classess

Composition, inheritance and delegation are 3 main methods to reuse classes.

Delegation is not a familiar concept for me, and it is not directly supported. However, I think I have used its content before. It just put a member object in the new class and expose all method to the new one.

About inheritance, it always calls the super() constructor even if you don’t called it literally in¬†derived class. As a result, if the base class don’t have a constructor without any parameters, and you don’t call base class constructor literally in derived class, you will get a compile time error. read more