How does friendship relation in C++ affect inheritance hierarchies, if at all?
- It overrides private inheritance.
- It allows base classes to access derived class members.
- It doesn't directly affect inheritance hierarchies.
- It breaks the "is-a" relationship in OOP.
Friendship is orthogonal to inheritance in C++. Declaring a function or class as a friend of another class doesn't have a direct impact on the inheritance hierarchy of classes. A friend function/class of a base class isn't automatically a friend of its derived classes.
Loading...
Related Quiz
- A specific version of a function template created for a particular data type is referred to as a template _______.
- If you want to force floating-point division in C++ when dividing two integers, one of the numbers should be _______.
- Imagine you are debugging a C++ application where a certain condition seems to always evaluate to true, even when you expect it not to. What could be a common mistake related to relational operators?
- How does encapsulation aid in reducing software development complexity?
- What is the role of the return statement in a lambda function?