The C++Course provides a general introduction to programming in C++. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details.


The Current Object

When you invoke a function on an object, that object becomes the current object. Inside the function, you can refer to the instance variables of the current object by name, without having to specify the name of the object.

You can also refer to the current object through the keyword this. We have already seen this in an assignment operator in Section 11.2. However, the this keyword is implicit most of the time, so you will rarely find any need for it.


Last Update: 2005-12-05