I posted a question recently: Initialization of Static Class members.
Now please check this code:
#include<iostream>
class A
{
static int obj_s;
public:
A()
{
obj_s++;
std::cout << A::obj_s << "
Object(s) Created
";
}
};
int A::obj_s = 0;
int main()
{
}
Even though one has not created any object of Class A, making the member obj_s
hold a value 0
- wouldn't it need memory since its getting defined?