Passing an address to a class and from there to its “child-class” by reference in C++
问题 "pointer" holds the address of "Int". I want to pass that address to my given classes by reference: class N { public: N(int &pPointer){ std::cout << "Address: " << &(pPointer) <<" \n"; } }; class M { public: M(int &pPointer):n(pPointer) { std::cout << "Address: " << &pPointer <<" \n"; } private: N n; }; int main () { int Int = 5; int *pointer = ∬ std::cout << "Address: " << pointer <<" \n"; M m(*pointer); return 0; } Is this a good practice (since I'm kind of using a reference to a