As I see in some code having something like "ClassName&".
For example:
// this demo
// check if a parameter passed to a member function is the object itself
#include <iostream>
using namespace std;
class CDummy {
public :
int isitme ([b]CDummy[u]&[/u] param[/b]);
};
int CDummy :: isitme ([b]CDummy[u]&[/u] param[/b]) {
if (¶m == this) return true;
else return false;
}
void main () {
CDummy a;
[b]CDummy*[/b] b = &a;
if (b -> [i]isitme(a)[/i]) {
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.