How is a friend class defined in C++?
- By inheriting the original class.
- By using the friendship keyword.
- By prefixing the class with the friend keyword.
- By including the class's header file in the original class.
A friend class in C++ is a class that is given permission to access the private and protected members of another class. To declare a class as a friend of another class, the friend keyword is used before the class declaration in the original class.
Loading...
Related Quiz
- In a graphics rendering engine, you need to store RGB color values. Which data type would be most appropriate for each color channel to balance memory usage and color depth?
- When trying to conserve memory usage, which method of parameter passing might be most effective in certain situations?
- The result of the expression (true || _______) in C++ will always be true.
- To check for possible errors or failures in file operations, you should check the _______.
- The standard namespace used commonly in C++ is _______.