0
To catch an error from a constructor
An exception (named invalid) was thrown from a constructor of class ( named myclass). try and catch was used to handel the exception in main function. Initialisation of a new variable (of user defined type myclass) was done int the try block. I could not use the defined variable outside the try block. i used try and catch only to catch invalid (thrown from constructor) but i need to use new variable in my program. please help me to fix this code for reference : https://code.sololearn.com/cn1eS1Ja7DV4/#cpp
1 Resposta