| 1. | What is polymorphism? | |
| 2. | What does it mean to override a function? | |
| 3. | How is overriding different from overloading? | |
| 4. | What is the syntax for a child class to inherit from two base classes (classa and classb)? | |
| 5. | What is a function’s interface? | |
| 6. | What is a function’s implementation | |
| 7. | How do you handle the situation where two base classes have the same function? | |
| 8. | What is a virtual function? | |
| 9. | What is an abstract class? | |
| 10. | How do you create an abstract class? | |
Answers
| 1. | It means functions with the same name but different code |
| 2. | To use the same name, return type, and parameters, but to change the code in the function |
| 3. | In overloading, you change the parameters; in overriding you do not. |
| 4. | childclass: public classa,classb |
| 5. | Its declaration line (i.e., its return type, name, and parameters) |
| 6. | The actual code in the function |
| 7. | Override the function in the derived class |
| 8. | A function that must be overridden in any derived class |
| 9. | A class that cannot be directly instantiated, but must be inherited to be used |
| 10. | By making any of its functions a pure virtual function. |