Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Tobes

  • 3 years ago

i need to make a player class for Rock Paper Scissors on C++ the object oriented way...with private attributes for weapon choice and score...any ideas?

  • This Question is Closed
  1. WLB250219
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    what is the weapon choices?

  2. Tobes
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    rock paper and scissors

  3. calculusnub
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Well think about it, how do you represent weapon choice and score? Weapon choice would probably be best as an enum, like so. enum WeaponChoice { ROCK, PAPER, SCISSORS }; I assume score is how many games they've won or lost, so that can just be an int. Then you just declare em as private members of your class. class Player { private: WeaponChoice weapon_choice; int score; };

  4. Tobes
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    thank you!

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy