// // (C) Porkolab 2003 // // A.8.8. // // Static linking: // file: x.cpp #include "x.h" X::X() { std::cerr << "X is created" << std::endl; } X X::xs; /////////////////////////////////////// // file: x.cpp #include "y.h" Y::Y() { std::cerr << "Y is created" << std::endl; } Y Y::ys; //////////////////////////////////////// // file: main.cpp #include <iostream> using namespace std; int main() { cout << "main is running" << endl; return 0; } // g++ main.cpp x.cpp y.cpp // output: Y is created X is created main is running // g++ main.cpp y.cpp x.cpp // output: X is created Y is created main is running