Why a class containing a static data member of the same class does not give compilation error?

Because static class members are not stored in the class instance, that's why a static would work.

Because static class members are not stored in the class instance, that's why a static would work. Storing an object inside another object of the same type would break the runtime - infinite size, right? What would sizeof return?

The size of the object needs to be known by the compiler, but since it contains an object of the same type, it doesn't make sense.

I'm guessing the error is something like field ‘a’ has incomplete type This is because when not static, the class A is not fully defined until the closing brace. Static member variables, on the other hand, need a separate definition step after the class is fully defined, which is why they work. Search for the difference between declaration and definition for more thorough explanations.

– Assaf Levy Dec 15 at 9:54 @AssafLevy What would the size of the object be. Base contains a Base, which contains a Base... – James Kanze Dec 15 at 9:57 @JamesKanze: Sort of two mirrors facing eachother.. Got it, thanks! – Assaf Levy Dec 15 at 10:01.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions