Bruce Eckel's Thinking in C++, 2nd Ed | Contents | Prev | Next |
//: C09:Evorder.cpp // Inline evaluation order class Forward { int i; public: Forward() : i(0) {} // Call to undeclared function: int f() const { return g() + 1; } int g() const { return i; } }; int main() { Forward F; F.f(); } ///:~
//: C09:Hidden.cpp // Hidden activities in inlines #include <iostream> using namespace std; class Member { int i, j, k; public: Member(int x = 0) { i = j = k = x; } ~Member() { cout << "~Member" << endl; } }; class WithMembers { Member q, r, s; // Have constructors int i; public: WithMembers(int ii) : i(ii) {} // Trivial? ~WithMembers() { cout << "~WithMembers" << endl; } }; int main() { WithMembers wm(1); } ///:~