Code:
#include<iostream>
using namespace std;
class A {
int a,b;
A obj;
};
main()
{
cout<< " making of the object \n";
A allo;
cout << "Object completed develpoped\n";
cout << sizeof(A);
cout << "now the size of object\n";
cout << sizeof(allo);
}
is not allowed.............but when I put static
Such as
Code:
#include<iostream>
using namespace std;
class A {
int a,b;
static A obj;
};
main()
{
cout<< " making of the object \n";
A allo;
cout << "Object completed develpoped\n";
cout << sizeof(A);
cout << "now the size of object\n";
cout << sizeof(allo);
}
sizeof(A); and the same 8 also in cout << sizeof(allo);
Can somebody throw some light on the behavior of static object in
its own class.

