.NET interview questions: - Show output for the following code of two classes?

53 0 0
                                        

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". 

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

.NET interview questions: - Show output for the following code of two classes?Where stories live. Discover now