Is it possible to compile under g++?
I've tryied compiling this with no success
Code:
#include <iostream>
using namespace std;
class SmallComponent {
private:
BigThing *outer;
public:
void sumar() {
int x = outer->i+outer->j;
cout << x << endl;
}
SmallComponent(BigThing *outer) : outer(outer) {}
};
class BigThing {
private:
SmallComponent small;
public:
doSomething() {
small.sumar();
}
int i;
int j;
BigThing() : small(this), i(2), j(4) {}
};
int main() {
BigThing clase;
clase.doSomething();
return 0;
}
It returns:
http://img684.imageshack.us/img684/2466/compile.jpg
Sorry for the image link, I can't copy it