The unary operator & gets a pointer to a variable. So, in C ++ (as in C) a = &b gets a pointer to b and stores this value in a , therefore, if b is of type int , a must be of type int* . Link assignment, on the other hand, is implicit, so if a is of type int& , you just need to write a=b to make a reference to b . Therefore, in your case, you need to rewrite your constructor as
RegionHolder(Region& Region1):m_RegionCellNOO(Region1.m_NOO) {}
However, I think you're better off using pointers than the links here, and trying to use C ++ without getting used to pointers is a very bad idea. Therefore, I suggest that you take the time to calm down with pointers instead of trying to avoid them.
source share