1 class Player{ 2 public: void setName (string a){ a;} void setScore (int b){ b; } string getName(){ return name;} 3 4 name = 6. Score = 7 int getScore(){ 10 return score;} 9. 11 12 private: 13 string...


I got this wrong, why?


1<br>class Player{<br>2<br>public:<br>void setName (string a){<br>a;}<br>void setScore (int b){<br>b; }<br>string getName(){<br>return name;}<br>3<br>4<br>name =<br>6.<br>Score =<br>7<br>int getScore(){<br>10 return score;}<br>9.<br>11<br>12 private:<br>13 string name;<br>14 int score;<br>15 };<br>

Extracted text: 1 class Player{ 2 public: void setName (string a){ a;} void setScore (int b){ b; } string getName(){ return name;} 3 4 name = 6. Score = 7 int getScore(){ 10 return score;} 9. 11 12 private: 13 string name; 14 int score; 15 };
Instructions<br>Write a full class definition for a class named Player, and containing the following members:<br>• A data member name of type string.<br>• A data member score of type int.<br>• A member function called setName that accepts a parameter and assigns it to name. The function returns no value.<br>• A member function called setScore that accepts a parameter and assigns it to score. The function returns no value.<br>• A member function called getName that accepts no parameters and returns the value of name.<br>• A member function called getScore that accepts no parameters and returns the value of score.<br>

Extracted text: Instructions Write a full class definition for a class named Player, and containing the following members: • A data member name of type string. • A data member score of type int. • A member function called setName that accepts a parameter and assigns it to name. The function returns no value. • A member function called setScore that accepts a parameter and assigns it to score. The function returns no value. • A member function called getName that accepts no parameters and returns the value of name. • A member function called getScore that accepts no parameters and returns the value of score.

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here