Java Language Inheritance vs Composition


Example

C++ & Java are both object-oriented languages, thus the following diagram applies to both.

Inheritance vs Composition Example