+ 4
int A :: b; what does this instruction mean?
the above code is declared below a class 'A' and b is the data member of the class A.
5 Answers
+ 10
:: is the scope resolution operator. It's used to access and initialize static class or namespace members.
+ 5
Because that's the default value.
+ 2
class A {
public:
static int b;
};
int A::b;
int main()
{
A x;
cout << x.b;
}
i get the out put has '0' but i didnt declare the value for b then how?
and what does " int A: b; " mean in this program??
also i just started learning c and c++đ
+ 2
@ helioform yeah i can get it
but i have not initialized the value of 'b' anywhere then how does it print the value has "0".
- 3
A::b mean A derive class, b base class.. did you really read and learn the C++ course ?