0 votes 0 votes #include<iostream> using namespace std; class abc { public: static int x; int i; abc() { i = ++x; } }; int abc::x; main() { abc m, n, p; cout<<m.x<<" "<<m.i<<endl; } Output is : 3 1 any one explain why '1' ? Programming in C programming + – renu sharma asked Aug 19, 2017 renu sharma 945 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Shubhanshu commented Aug 19, 2017 reply Follow Share I have not seen OOPs from long time, may you please tell me the meaning of this line. int abc::x; 0 votes 0 votes renu sharma commented Aug 20, 2017 reply Follow Share To access a class’s static variables using scope resolution operator. 0 votes 0 votes Shubhanshu commented Aug 21, 2017 reply Follow Share It is used only for static data items of the class. Otherwise, it will show the error:- undefined reference to `abc::x'. 0 votes 0 votes Please log in or register to add a comment.