// In this example, all the methods are inline. // Don’t do this for anything but the smallest classes. #include class Random { // A truly awful random number class public: Random(int seed) { state = seed; } int value() { state = state * 1234567891 + 9708675309; return (state & 0x7fffffff) % 100; } private: int state; }; int main() { Random r(1234); for (int i=0; i<20; i++) std::cout << r.value() << ' '; }