What is use of Address Operator (&) in this program?

// this
#include <iostream>
using namespace std;

class CDummy {
public:
int isitme (CDummy& param);
};

int CDummy::isitme (CDummy& param)
{
if (&param == this) return true;
else return false;
}

int main ()
{
CDummy a;
CDummy* b = &a;
if ( b->isitme(a) )
cout << "yes, &a is b";
return 0;
}


in function isitme, why is there an & in parameters?
Can anyone tell me the working of the program as it goes?
Thanks.
The '&' operator retrieves the pointer of an object (in this context). It's a comparison of 2 pointers.
In the function's parameter list, the & means that, param is a CDummy reference.

For more info on references : http://cplus.about.com/od/learning1/ss/references.htm
if pass the address of the object a the object b ( only the address ) . so that b is equal to a
Topic archived. No new replies allowed.