c++ convert from new to instance -
c++ convert from new to instance -
there problem confuses me
i created new variable
foo *a=new foo();
then declared instance variable
foo b;
now want convert new variable instance variable, did
b.setvalue0(a->getvalue0()); b.setvalue1(a->getvalue1()); b.setvalue2(a->getvalue2());
is there easier faster way this?
you can utilize re-create constructor:
foo b(*a);
assuming of course of study copying object permitted.
c++
Comments
Post a Comment