In class2
, you are calling Console.WriteLine(c1.inf1());
.
So class1.inf1
should return a string as you are trying to output it to the console.
However, class1.inf1()
recursively calls itself with no exit and does not return a string.
So I think this may be what you are trying to accomplish:
protected internal string inf1()
{
return "\n......inf1() \n";
}
1
solved Getting Infinite Loop Issue. Process Terminated due to StackOverflowException?