4 ms·
Yes you can use exceptions to handle errors in the constructor, but you can just as easily do: guard x(); if (!x) { // an error occurred
by readams 11y ago
Yes you can use exceptions to handle errors in the constructor, but you can just as easily do:
guard x();
if (!x) {
// an error occurred
return x.error_code();
}
x->do_stuff();
You don't have exceptions so of course you're now required to check for errors explicitly.