Q7Object Oriented Programming
Question
What are the application of this pointer?
Answer
The this pointer explicitly resolves severe naming collisions by holding the absolute memory address of the actively executing object.
The this pointer is a hidden, const pointer mathematically passed into every non-static member function. Its primary applications are: 1) Violently resolving naming collisions when a local function parameter has the exact same name as a class member variable (e.g., this->age = age;), and 2) Allowing an object to rigorously return a reference to itself for method chaining.