Archived

This topic is now archived and is closed to further replies.

proper design

This topic is 5500 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi. i''m to rewrite my game code using c++ and proper class hierarchy (spelling) but i''ve got some questions about "classing" and this is MY thoughts about the structure: class Window() <- a superclass, window creation and configuration class Renderer() <- a subclass to the Window class, D3D Initialization() class Engine() <- a hybrid class / subclass to the renderer class, Engine hub class Input() <- a subclass to the window class (window dimension), DI Initialization class Engine() <- a hybrid class / subclass to the Input engine, still the Engine hub. can this be a good way of doing this?

Share this post


Link to post
Share on other sites
quote:
Original post by Metus
class Window() <- a superclass, window creation and configuration
class Renderer() <- a subclass to the Window class, D3D Initialization()


A Renderer is-not a Window.
quote:

class Engine() <- a hybrid class / subclass to the renderer class, Engine hub


An Engine is-not a Renderer, nor is it a Window.
quote:

class Input() <- a subclass to the window class (window dimension), DI Initialization


An Input(!) is-not a Window.
quote:

class Engine() <- a hybrid class / subclass to the Input engine, still the Engine hub.


An Engine is-not an Input, nor is it a Window.
quote:

can this be a good way of doing this?


Not particularly.



God puts an apple tree in the middle of the Garden of Eden and says, do what you like guys, oh, but don''t eat the apple. Surprise surprise, they eat it and he leaps out from behind a bush shouting "Gotcha." It wouldn''t have made any difference if they hadn''t eaten it... because if you''re dealing with somebody who has the sort of mentality which likes leaving hats on the pavement with bricks under them you know perfectly well they won''t give up. They''ll get you in the end. -- Douglas Adams

Share this post


Link to post
Share on other sites
oh, sorry about that, i forgot to specify the type of heritage..
it should be of "Has-One" heritage..
the engine HAS a render, the renderer HAS (am i wrong) a window...
the engine HAS an input and so on...

Share this post


Link to post
Share on other sites
quote:
Original post by Metus
it should be of "Has-One" heritage..

That''s not inheritance - that''s called composition or aggregation. Other than that it sounds good.



God puts an apple tree in the middle of the Garden of Eden and says, do what you like guys, oh, but don''t eat the apple. Surprise surprise, they eat it and he leaps out from behind a bush shouting "Gotcha." It wouldn''t have made any difference if they hadn''t eaten it... because if you''re dealing with somebody who has the sort of mentality which likes leaving hats on the pavement with bricks under them you know perfectly well they won''t give up. They''ll get you in the end. -- Douglas Adams

Share this post


Link to post
Share on other sites