In C++ every object has a “this” pointer. You could think of it as being passed as an implicit argument to every non static member function that the object has. It can never be null so why isn’t it a reference?
The reason I started wondering about this is that when using wiring objects together, such as when using parameterise from above, I often find myself wanting to pass a reference to the current class to some related object. More often than not I actually want to pass a reference and not a pointer, because the relationship is not optional and the pointer can never be null. Because
this is a pointer my code ends up littered with pointer dereferencing
*’s to convert
CFoo * to
CFoo & like this