Generalized Power Rule
C++ supports multiple inheritances. What is the “diamond problem” that can occur with multiple inheritances? Give an example.
It means that we cannot create hybrid inheritance using multiple and hierarchical inheritances. Let’s consider a simple example. A university has people who are affiliated with it. Some are students, some are faculty members, some are administrators, and so on. So a simple inheritance scheme might have different types of people in different roles, all of whom inherit from one common “Person” class. The Person class could define an abstract getRole() method which would then be overridden by its subclasses to return the correct role type. But now what happens if we want to model a role of a Teaching Assistant (TA)? Typically, a TA is both a grad student and a faculty member. This yields the classic diamond problem of multiple inheritances and the resulting ambiguity regarding the TA’s getRole() method:
When does the Sky become Space?
The official boundary between the Earth's atmosphere (sky) and space is called the Kármán line. This line lies 100km above sea level and is named after aeronautical scientist Theodore von Kármán. Aircraft generate lift due to the flow of air over their wings; the air thins with increasing altitude meaning aircraft must move faster to remain airborne. von Kármán calculated that at 100km, it was more efficient for vehicles to orbit the Earth than to fly. Above 100km, aircraft would have to move faster than satellites orbiting the Earth to generate sufficient lift to stay airborne.