CPlusOOP
SiteMap
Reusable Software
Structured Programming
Operator Overloading
«Prev
Reusable Code
Polymorphism Concept
Define Polymorphism Concept
Difference Conversion Overloading
ADT Conversion
Conversion Member Functions
Comparing Conversion Operators
Compiler Selects Overloaded Function
Signature Matching Algorithm
Selection Algorithm Function Overloading
Overloaded Function Example
Using Polymorphism Conclusion
Operator Overloading
Overload Operators
Overloadable Operator Types
Declare Friend Function
friend Function Usage
Operator Keyword
Unary Binary Operator Overloading
Overloading Unary Operators
Overloading Binary Operators
Overloading Assignment Operator
Input Output Operators
Overloading Output Operator
Overloading Input Operator
Overloading Pointer Operator
Overloading New Delete
Operator Overloading Guidelines
Overloading Operators Summary
friend Function - Quiz
Pure Polymorphism
Define Class Inheritance
Pure Polymorphism
Derived Class
Public Inheritance
public Inheritance - Quiz
Constructors Base
Reference Typing Conversions
print member-function
Virtual Functions
Guidelines Virtual Functions
Virtual Function - Selection
Virtual Function - Exercise
Abstract Classes
Reinterpret const cast
Dynamic cast Operator
RTTI
typeid Operator
throw C++ Exception
Pure Polymorphism Conclusion
Ecological Simulation
Friend functions in C++ - Quiz
Each question is worth one point. Select the best answer or answers for each question.
1.
A friend function declaration:
A.
gives nonmember functions access to hidden class members
B.
is another term for an overloaded function within a class
C.
is any function created for you by the compiler (such as a default constructor)
D.
is any function outside the class with the same name as a function in the class
2.
A
friend
function declaration appears:
A.
in the header of the
friend
function outside the class
B.
inside the class declaration to which it is a
friend
C.
as a separate declaration inside
main()
D.
anywhere prior to the function invocation
3.
How is a static member function similar to a friend function?
A.
A static member function is like a friend function that doesn't need to be public:.
B.
A friend function is similar to binary operator overloading.
C.
A friend function has an implicit
this
parameter .
D.
A friend function does not have direct access to the class’s 1) private: and 2) protected: parts.
4.
Which of the following is true about friend functions in C++?**
Please select the best answer.
A.
A friend function is inherited by derived classes.
B.
A friend function is a member of the class that declares it as a friend.
C.
A friend function can be declared in multiple classes.
D.
A friend function can access private and protected members of the class that declares it as a friend.
Correct answers:
Your Score: 0
Submit
Quiz Explanation