Lecture overview -- Keyboard shortcut: 'u'  Previous page: Const member functions - const and mutable -- Keyboard shortcut: 'p'  Next page: Inline member functions -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 3 - Page 24 : 36
Notes about C++
Abstraction Mechanisms, Part 1
Object Self-reference

In non-static member functions, this is a pointer to the object on which the function has been invoked

  • The C++ Programming Language: Page 230
 

y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/self-reference/point.hClass Point - almost the usual header file.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/self-reference/point.ccClass Point - a variant with explicit use of this.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/self-reference/prog.ccA sample use of points, with emphasis on moving.


The use of this in C++ is similar to the use of this in both C# and Java