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

Popular posts from this blog

php - How to pass multiple values from url -

database - php search bar when I press submit with nothing in the search bar it shows all the data -

ios - How to load .png images from Documents folder of an app -