I have the following snippet fragment
Class Sample
{ Obj_Class1 o1;
Obj_Class2 o2;};
But the size Obj_Class1and Obj_Class2enormous, so the compiler shows warning "Consider the movement of a space in a heap." I was asked to replace Obj_Class1 o1 with Obj_Class1* o1 = new Obj_Class1();But I feel that using this change is not practical, as heap allocation will also fail if the stack allocation fails. I'm right? Or it makes sense to make this change (other than suppressing the compiler warning).
source
share