I tried to do
MyClass& x;
x = MyClass(a,b,c);
But C ++ will not let me do this because it believes that x is not initialized at the beginning.
So I tried to do
MyClass& x = MyClass(a,b,c);
But an error occurred, saying invalid initialization of non-const reference of type 'MyClass&' from an rvalue of type 'MyClass'
What about him? It seems I just canβt do anything now. How do I solve the initialization problem?
source
share