// this demo
// check if a parameter passed to a member function is the object itself
#include <iostream>
usingnamespace std;
class CDummy {
public :
int isitme (CDummy& param);
};
int CDummy :: isitme (CDummy& param) {
if (¶m == this) returntrue;
elsereturnfalse;
}
void main () {
CDummy a;
CDummy* b = &a;
if (b -> isitme(a)) {
cout << "yes, &a is b";
}
}
I know "ClassName*" is used to declare a pointer to a class instantiation. But what is "ClassName&"? What is the difference between the "&" reference operator and this "&" in "ClassName&"?
Sorry if it is a stupid question!
Thank for any help.