11 November 2020

Deadly diamond of death:

                      Grandma
                      /      \
                     /        \
                 Mama        Papa
                 f()         f()
                     \       /
                      \     /
                       Baby


Baby b = new Baby();
b.f()  //uh oh  WHO'S f()?

C++

                     stream
                    /      \
              istream      ostream
                    \      /
                    iostream

reason it works: strict separation of function
with istream and iostreeam.

Inheritance is an "is-a" relationship.
It is also a subtype relationship.

A final class cannot be subclassed:
    String
    Wrappers for primitives