Original Post
Ok, so I have been trying to learn OOP recently, I read books, I tried some simple sample programs. A few days ago I thought I knew enough about C++ to make a little Pong-game in OOP. So at first, I thought, how would I do it? I came up with the following plan: I made a class for the Bats, which has a "draw()" and a "move()"-method, a "Control" Method, which accepts Keyboardinput according to wether it is the right or the left bat and some interface methods to acces and set the position; then I had a Ball-class, again with drawing, moving and Interfacemethods. In the main program file (which uses the modules where the classes are declared and defined) I made two global instances of the bats and one of the ball. Then I ran into a problem I haven''t foreseen; how does the Ball know where the Bats are, when he moves? I mean, there are 2 instances of bats and a Ball-instance, but they aren''t really "connected" (I put them into seperate modules, and there the methods of the ball knew of course nothing about the 2 bats); so my question is, how do I solve this problem in an elegant an "OOP" way?