I've seen a lot of two-phase initialization used. The justification is to call virtual functions from the secondary constructor. However, I've never, ever, seen any use case in which this was necessary. Are there any?
On platforms where there is no support for exceptions, or the code size increase due to exception handling is unacceptable, two-phase initialization allows you to put activities that might fail in the secondary constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With