#include using namespace std ; class Demo { public: static int z1 ; static void print() { cout << "z1:" << z1 << " " << x1 << endl ; } int x1 ; int x2 ; }; int Demo::z1 = 0 ; int main() { Demo obj1 ; obj1.x1 = 2 ; obj1.x2 = 3 ; obj1.z1 = 1 ; Demo obj2 ; obj2.x1 = 4 ; obj2.x2 = 5 ; obj1.z1 = 2 ; cout << obj1.x1 << " " << obj1.x2 << " " << obj1.z1 << endl ; cout << obj2.x1 << " " << obj2.x2 << " " << obj2.z1 << endl ; obj1.print() ; obj2.print() ; Demo::z1 = 100 ; Demo::print() ; return 0 ; }