C++ Translation of Java Dyn Link
#include <iostream>
using std::cout;
using std::endl;
class Stuff {
private:
int a, b;
int fred(int b) {
a = a + b;
return 4;
}
class Barney {
private:
int a;
Stuff *dad;
void sigfreid() {
a = dad->fred(a);
}
public:
Barney(Stuff *_dad) { dad = _dad; }
void barney(int c) {
a = c;
sigfreid();
cout << a << " " << dad->b << " " << c << endl;
}
};
public:
Stuff() {
a = 2;
b = 7;
Barney barn(this);
barn.barney(3);
cout << a << " " << b << endl;
}
};
int main(int argc, char **argv)
{
Stuff s;
}