1. Back To Blog

.NET interview questions: - What will be the result when Class1 creates objects of Class2 and Class2 creates object of Class1?

See the following snap code: -
 

class Class1 

 Class2 o = new Class2();
}
class Class2

 Class1 o = new Class1();
}


Answer:


Both the classes are creating objects of each other due which the object will pile up in the memory and lead to "StackOverFlowException". Below is the error image which is displayed once the memory is overused.




See the following video on regular expressions along with some practical demonstrations as follows: -


 

Visit to get more stuff on Dotnet interview questions and answers  


Regards,


Also visit for more author's other blogs on Most asked Dotnet interview questions
 

Shiv Prasad Koirala

Visit us @ www.questpond.com or call us at 022-66752917... read more

We are on Social