Which of the following is a correct statement about friend functions in C++?
- They are member functions of a class
- They can be inherited by derived classes
- They always improve performance of the program
- They do not have access to the 'this' pointer of the class
In C++, the 'this' pointer is an implicit pointer to the object on which a member function is called. Since friend functions are not member functions of a class, they do not have access to this pointer. They operate as external functions with special access permissions.
Loading...
Related Quiz
- Which data type would be most appropriate for storing a boolean value?
- In what scenario might a weak_ptr be particularly useful to prevent?
- In terms of object-oriented design principles, what is typically the most significant critique against the use of friend functions?
- A _______ block is used to enclose the code that might throw an exception.
- When a pointer is passed to a function, the function receives _______?