1/* If you make a static object and a non-static object of the same class,
2and then use that static object in any way, you will get a stack overflow.
3
4I will give an example of some code that will result in stack overflow.
5*/
6
7using System;
8using System.Collections.Generic;
9
10namespace Grepper
11{
12 class Program
13 {
14 static Program obj_1 = new Program(); //static of Program class
15 Program obj_2 = new Program(); //non-static of Program class
16
17 static void Main(string[] args)
18 {
19 obj_1.DoSomething(); //using static object
20 }
21
22 void DoSomething()
23 {
24 }
25 }
26}