I just started learning how to handle errors with C ++, but before that I was familiar with java. This is where the construction works:
try { int d = 2/0; } catch(ArithmeticException t) { System.out.println("Error!!!"); } And immediately I wanted to implement something like that in c ++, but to my regret I did not find any ready-made classes, except for exception . Can you please tell me where I couldn鈥檛 see where there are any ready-made constructions / classes? How to implement a similar design on the pros? Is it possible to create exceptions at all without the throw keyword?
If there are links with great / good material to handle errors in c ++, please drop it. Do I understand correctly that in c ++ there is nothing at all ready, as in java, and everything has to be done with pens?
throw new int(10). Generally, exceptions are not very peculiar with ++, in order to catch the NPE, you need to write non-trivial platform dependent code ... Of the frequent exception, bad_aloc when memory is not allocated, I don鈥檛 even remember the others right away ... But with method, first check and then do not the other way around - pavel