3 ms·
Best to create object then initialize it in a separate method.
by rr808 5y ago
Best to create object then initialize it in a separate method.
- masklinn 5y agoBecause that meshes so well with copy and move ctors, const and reference members, or inheritance.
- edflsafoiewq 5y agoIt meshes well with move ctors at least, since objects need a "dead state" they can be put into when moved from.
- Koshkin 5y agoThis is incorrect. You are not supposed to make any assumptions about the state of an object that has been destructed or moved from. A “dead state” would still be a state, whereas a “dead object” should be thought of as having no state at all, i.e. not being an object any longer.
- ncmncm 5y agoBy "best" you mean, of course, "worst".
- gpderetta 5y agoAmen.