Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6087417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:52:05+00:00 2026-05-23T11:52:05+00:00

I am new to C++ programming, and I am making Pong in Visual C++.

  • 0

I am new to C++ programming, and I am making Pong in Visual C++. My game will have two game modes, multiplayer and singleplayer. Right now, I am planning on having a separate class for the singleplayer paddles and the multiplayer paddles. (So I’ll have PaddleMP RpaddleMP, LpaddleMP; and PaddleSP RpaddleSP, LpaddleSP;, where the R and L represent the right and left paddles respectively). However, the code for the multiplayer paddle and singleplayer paddle will be very similar. Would it be better to use one class for them both and simply have an initializer function that allows me to pick whether it is a singleplayer or multiplayer paddle, or should I just make a new class for both?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:52:05+00:00Added an answer on May 23, 2026 at 11:52 am

    IMO, you have two problems here. First, I think the names you’ve chosen (single player vs. multiplayer) are poor. Second, I think the paddle itself should be independent of the input that moves the paddle.

    Therefore, there should really only be one paddle type. You can tell it to move up or down and it’ll move the direction you’ve told it, but the paddle itself knows nothing about the source of the movement command(s).

    Then I’d have something that creates/sends the input to the paddle. It seems to me that rather than single player vs. multi-player the relevant distinction here is between a player input and an AI input.

    So, we have a player input that reads relevant data from the mouse, keyboard, joystick, etc., and turns it into the relevant commands to send to the paddle. We also have an AI input that produces similar commands, but based on its own computation rather than input from the user.

    This is where you want the inheritance — the AI input and the player input both inherit from generic input type that can produce commands. Depending on your taste, you might not want an actual player input either — rather, you might have a keyboard input, joystick input and mouse input separate from each other. This will, for example, probably make it a bit easier if you decide to add support for something like a multi-touch screen, which will probably be at least somewhat different from any of the above (but still follow the same protocol/implement the same interface).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to twisted and programming, I'm making a multiplayer game, and what i
I'm new to Android programming and I am making a game. My problem is
This is been making my programming really frustrating lately. I´m in Argentina right now
I am new to Android programming, and I am making a number guessing game
Im new to programming and I dont know very much about but I'm making
I'm somewhat new to OOP programming so it's very likely I'm making some stupid
I'm fairly new to C# programming. I am making a program for fun that
I am new to programming so bear with me. I have an XML document
I am making my own crude MP3 player, and I now have a JList
I'm still new to programming in excel and I am having trouble making slight

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.