Domanda di colloquio di Tudip Technologies

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

Risposta di colloquio

Anonimo

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.