posted 17 years ago
It's the member
one p=new one();
that causes the problem. That means every time you construct a "one" object, when its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed. While its member variable "p" is being initialized, another "one" object will be constructed... and eventually there are so many half-executed constructors on the stack, that you get a stack overflow.