Skip to content

Instantly share code, notes, and snippets.

@slawosz
Created October 20, 2011 00:20
Show Gist options
  • Save slawosz/1300068 to your computer and use it in GitHub Desktop.
Save slawosz/1300068 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
class Container;
class Element;
class Container {
private:
Element *container[100];
int i;
public:
Container() {
i = 0;
}
void add(Element *e);
};
void Container::add(Element *e) {
container[i] = e;
i++;
}
class Element {
private:
public:
Element(Container _container) {
Container container = _container;
container.add(this);
}
};
int main() {
Container c;
Element* e1 = new Element(c);
Element* e2 = new Element(c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment