Multiple choice technology programming languages

In C++, this pointer is used by the symbol___

  1. . (dot)

  2. ,

  3. ->

  4. >

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

-> (arrow operator) is correct because it is used with pointers to access members of an object. The dot operator (A) is used with object references, commas (B) are separators, and > (D) is a comparison or stream operator. The this pointer is a pointer, so it uses -> for member access.

AI explanation

In C++, the 'this' pointer (an implicit pointer to the current object available inside non-static member functions) is a pointer, so members are accessed through it using the arrow operator '->', e.g., this->memberVar. The dot operator '.' is used to access members through an actual object (not a pointer), so it wouldn't apply to 'this' directly without first dereferencing it (*this).memberVar. The comma and plain '>' options are not member-access operators at all and are irrelevant here.