Is this writing style good?

Is this good way to do it? To make window's friend class engine and then let the engine access window's private functions?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Window {

		friend class Engine;

		GLFWwindow* window_;

		bool created_ = false;

	private:

		void createOpenGLWindow(Window_Blueprint window_blueprint);

		void draw();

		GLFWwindow* getOpenGLWindow();

	public:

		bool isCreated();

	};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Engine {

		Window window_;

		bool initialized_ = false;

	public:

		Engine();

		void initialize(Window_Blueprint window_blueprint);

		void shutdown();

		Window* getWindow();

		bool isInitialized();

	};


Thanks :)
Last edited on
Topic archived. No new replies allowed.