Skip to content

Instantly share code, notes, and snippets.

@thiagomg
Last active November 5, 2015 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagomg/9a22c15e33e1c9c82692 to your computer and use it in GitHub Desktop.
Save thiagomg/9a22c15e33e1c9c82692 to your computer and use it in GitHub Desktop.
Ciclic dependency problem
//File main_window.h --------------------
#pragma once
#include "window.h"
struct main_window {
void close_child();
private:
window child;
};
//File window.h -------------------------
#pragma once
#include <string>
#include "main_window.h"
struct window {
window(main_window &parent) : _parent(parent) { }
void close();
private:
main_window &_parent;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment