In C++, which operator is used to access members of a class using a pointer ?
2025
In C++, which operator is used to access members of a class using a pointer ?
- A.
.
- B.
-> - C.
::
- D.
&
Attempted by 77 students.
Show answer & explanation
Correct answer: B
In C++, the arrow operator (->) is used to access members of a class through a pointer. This operator combines dereferencing the pointer and accessing the member in one step, making code more readable than using (*pointer).member syntax.