Sollicitatievraag bij Tudip Technologies

Can we write try catch block in constructor? Link list ,stack ,queue, virtual function ,pointers

Antwoord op sollicitatievraag

Anoniem

15 nov 2019

Like any method can throw exception, a constructor can also throw a exception since it is also a method which is invoked when a object is created. yes we can write a try catchblock within a constructor same as we can write in inside a method.