Q
Qin Chen
Hi, all!
I need some experieced coder to explain what the following code will
produce, thank you!
#inlcude <iostream>
using namespace std;
class WithStatic{
static int x;
static int y;
public:
void print(void);
};
void WithStatic:rint(void)
{
cout << "x = " << x << endl;
cout << "y = " << y << endl;
}
int x = 100;
int WithStatic::y = x + 1;
int WithStatic::x = 10;
int main()
{
WithStatic ws;
ws.print();
}
I need some experieced coder to explain what the following code will
produce, thank you!
#inlcude <iostream>
using namespace std;
class WithStatic{
static int x;
static int y;
public:
void print(void);
};
void WithStatic:rint(void)
{
cout << "x = " << x << endl;
cout << "y = " << y << endl;
}
int x = 100;
int WithStatic::y = x + 1;
int WithStatic::x = 10;
int main()
{
WithStatic ws;
ws.print();
}