Inheritance

For project in my class I'm having to implement tetris clone. I cant out everything in once class, so I have a class, lets call A, that keeps the track of score, time, play, etc. I also have a class B that keeps track of the content inside of the game board. Then have a third class C that controls the rotation, movement, etc of each piece. Lastly there is a class for each individual piece. There is also a console class that contains all the print methods

My problem is that I am having a hard time wrapping my brain around how Class B will know when the game starts how it will update the score etc. Or how Class B will be able to print the content of the board when all those functions are in the console class. I know that the individual pieces inherit from Class C but Class A, B and the Console don't inherit from anyone.

Note: I dont have any code to share to better explain my problem because I dont know where to start... Thanks in advance. Also like I stated above this is a project so Im not asking for direct answers just some basic example that might make this click.
You have the tires, the glass windows, and the pistons, but you're missing the steering wheel.

You need another class that brings everything together - it would have an instance of the console class, it would have an instance of class A, and it would have an instance of class B.
Agree with LB based on experience. In a game I will often times have a class called "Engine" or "Game" that is the "One Class to Rule Them All". You have classes that have specific tasks, then one class that gets them all to work together successfully.
Topic archived. No new replies allowed.