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 ?
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…
- A.
.
- B.
-> - C.
::
- D.
&
Attempted by 222 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.
Loading lesson…