P
Philipp
Hello, in my main() I have code which looks like this
MyClass* myObject;
if ( param.isValid() )
myObject = new MyClass(otherParam, param);
else
myObject = new MyClass(otherParam);
-----
Now myObject is allocated as freestore which is not so good (says FAQ
31.4
http://www.parashift.com/c++-faq-lite/value-vs-ref-semantics.html#faq-31.7)
Is it possible to do the same thing by using value semantics?
Note that MyClass does not have a constructor without arguments.
Thanks Phil
MyClass* myObject;
if ( param.isValid() )
myObject = new MyClass(otherParam, param);
else
myObject = new MyClass(otherParam);
-----
Now myObject is allocated as freestore which is not so good (says FAQ
31.4
http://www.parashift.com/c++-faq-lite/value-vs-ref-semantics.html#faq-31.7)
Is it possible to do the same thing by using value semantics?
Note that MyClass does not have a constructor without arguments.
Thanks Phil