It is undefined behaviour, you are accessing a member method from a nullptr
. No particular behaviour or outcome would be defined.
In this case though; given (cppreference):
The keyword this
is a prvalue expression whose value is the address of the object, on which the member function is being called.
Since the NULL
value of this
is not being dereference - the member method is not virtual and doesn't access any member data of this
- it "seems" to work.