Here we have a look at class inheritance in C++.
The principle of class inheritance is the same as in Java
Everything else is different.
- The syntax for declaring an inheritance is a bit different.
- There is no super, and there are different ways to
refer to the base class.
- Polymorphism is handled quite differently. (Yes, I will tell you
what I'm talking about at some point.)
- There is a protected: keyword, which is a bit more restrictive
than the one in Java.
- C++ allows multiple inhertance (inherit from multiple base classes).
- We probably won't talk about it much.
- Most reasonable use is to simulate something similar to Java's
interfaces, since C++ does not have those. Many C++
coding shops have rules limiting multiple inheritance
to this use.
Textbook: Chapter 15