hi Guys,
i got a question...
lets say i have a class "A" that can only be constructed with an int parameter
like this:
how can i reinitialized objA?Code:A objA(1);
first attempt:
but i get a compile error that the term doesn't evaluate to to 1 argument. am i missing parameters? ( there is nothing else named objA )Code:A objA(1); objA(2);
second attempt:
i get the error : 'function-style cast' : illegal as right side of '.' operatorCode:A objA(1); objA.A(2);
if i do this:
against my will the deconstructor of the temporary object get called and the copied data members become invalid.Code:A objA(1); objA = A(2);
i've tried this:
but when objNewA goes out of scope it will get destructed.Code:A objA(1); objA = A(2); A objNewA(2); objA = objNewA;
basicly i just want to call the constructor of an object again. do i have to use A by reference or something?
can someone please explain?



LinkBack URL
About LinkBacks


