proper design
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?
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
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...
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...
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement