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 ?

  1. A.

    .

  2. B.

    ->

  3. C.

    ::

  4. 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.

Explore the full course: Tpsc Assistant Technical Officer