Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this a pointer [duplicate]

Tags:

c++

Possible Duplicate:
Why 'this' is a pointer and not a reference?

Why is this a pointer, rather rhan reference? Can it ever be NULL?

like image 731
Anycorn Avatar asked Nov 05 '10 04:11

Anycorn


1 Answers

Why is "this" not a reference?

See Bjarne's answer here

Because "this" was introduced into C++ (really into C with Classes) before references were added. Also, I chose "this" to follow Simula usage, rather than the (later) Smalltalk use of "self".

like image 127
Prasoon Saurav Avatar answered Sep 22 '22 01:09

Prasoon Saurav