Why when I try to instantiate a class instance, do I get StackOverFlowException?
Posted
by flockofcode
on Stack Overflow
See other posts from Stack Overflow
or by flockofcode
Published on 2010-06-13T18:51:46Z
Indexed on
2010/06/13
18:52 UTC
Read the original article
Hit count: 140
c#
I keep getting StackOverFlowException
whenever I instantiate an instance of A class. I know it has got something to do with the fact that A.b
field is of type derived from class A. But why would that cause an exception?
static void Main(string[] args)
{
A a = new A(); // exception
}
class A
{
private B b = new B();
}
class B:A {}
thank you
© Stack Overflow or respective owner