The operator used to access member functions of a class from its object is
2017
The operator used to access member functions of a class from its object is
- A.
' / '
- B.
' . ' / '. '
- C.
: / :
- D.
+/ +
Attempted by 222 students.
Show answer & explanation
Correct answer: B
Correct Answer: '.' (dot operator) Explanation: Use the dot operator to access members from an object. Example: if obj is an object of class C, call a member function as obj.func();
If you have a pointer to an object, use the arrow operator (->) to access members, e.g., p->func();
The scope resolution operator (::) is different: it’s used to define or refer to names in a class or namespace scope (for example defining a member function outside the class or accessing static members), not for accessing members through an object instance.