أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
We recommended to use composition , as using extends key word it inheriits all the method from the base class(parent class), which in certain cases increases the complexity and length of the code, while using composition we call only the specific method as the condition demand.
the basic rule for that is:
inheritance = "is a" relationship
composition = "has a" relationship