Untitled
public text v1 · immutable$ 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