All pastes #776698 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-16 06:03 UTC
rendered paste body
$ cat moo.cpp; echo "===="; g++ -o moo moo.cpp; ./moo
using namespace std;
#include <iostream>

class test {
private:
        int foo;
public:
        void init(int moo) {
                foo = moo;
        }
        test(int moo) {
                init(moo);
        }
        test() {
                init(5);
        }
        int get_value() {
                return foo;
        }
};

int main()
{
        test* bagel = new test();
        cout << bagel->get_value() << "\n";
        delete bagel;
        return 0;
}


====
5