Answer the question
In order to leave comments, you need to log in
Statements inside constructor initialization list?
Is there a way to write multiple staments in the constructor's initialization list?
class Example
{
private:
ExtremelyHeavyObject obj;
public:
Example():
obj
(
ExtremelyHeavyObjectBuilder builder;
builder.method1();
builder.method2();
builder.method3();
/* Some code here */
return builder.build(); // Assign to obj builder.build() result
)
{}
};
ExtremelyHeavyObject obj *
it, since it would require additional. allocations/de-allocations as well as an extra direct
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question