In C++, the $friend$ keyword allows a class or function to access the private and protected members of another class. When one class (let's call it Class A) declares another class (Class B) as its $friend$, it grants specific access privileges.
The declaration of friendship is asymmetric. When Class A declares Class B as a friend:
Therefore, the correct statement is that all member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
Which operator is used for dynamic memory allocation in C++?
Which statements is correct regarding main () function in C++?
I. It is a user defined function.
II. It is a pre-defined function.
Consider the following segment of C++ code.
int j, n;
for(j=1;j<=n; )
j=j*2;
What is the number of comparisons made in the execution of the loop for any n > 0?