#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;
}
GreenWater
Sorry fellas
Pls Wat is d output of this code
David
@Aygafsam Please, use pastebin for code or use the ` quote
David
@Aygafsam And why you ask for the output? you can run it yourself
GreenWater
I don't hv compiler here
David
@Aygafsam there are online compilers. btw, the output is 3 and 1
GreenWater
Tanx
David
because x is static, for each instance of abc class it will increment by one so m.x will be 3
download mingw. it's easy to setup. use codeblocks IDE. it's easy. or better if you can get a copy of the microsoft c++ compiler. comes with the visual studio. This is the best c++ compiler out there.