WRT below code, Abc & Xyz are 2 classes.
I get a reference in DoOperation(Xyz& temp) and want to assign it to a class data member i.e mem1, so that this reference can be used by other member functions lile DOOperation_2(), DOOperation_3() etc..
I know we can't declare a reference in C++ without initialization. But how do I handle such a scenario in C++ ?
class Abc
{
public:
Xyz& mem; //ILLEGAL IN C++
void DoOperation(Xyz& temp)
{
mem = temp;
}
void DOOperation_2()
{
}
DOOperation_3()
{
}
};