The code is not for any project, I just want to know the best coding practices.  The code is also on GitHub.#include <iostream>#include <new>#include <typeinfo>using namespace std;/**************************************************************** * Exceptions ****************************************************************/class RuntimeException {private:  string errorMsg;public:  RuntimeException(const string& err) { errorMsg = err; }  string getMessage() const { return errorMsg; }};class IndexOutOfBounds : public RuntimeException {public:  IndexOutOfBounds(const string& err = Index out of bounds!)    : RuntimeException(err) {}};/**************************************************************** * Chapter 3.1 - Game Entries * ****************************************************************/// Game entry data structure:class GameEntry {       // Stores the game scorespublic:  GameEntry(const string& n = , int s = 0); // Constructor  string getName() const;             // Get player name  int getScore() const;               // Get player scoreprivate:  string name;          // Player's name  int score;            // Player's score};// Definitions for Game entryGameEntry::GameEntry(const string& n, int s)  : name(n), score(s) {}string GameEntry::getName() const { return name; }int GameEntry::getScore() const { return score; }ostream& operator<<(ostream& out, const GameEntry& obj) {  out << '{' << obj.getName() << ',' << obj.getScore() << '}';  return out;}// Scores data structureclass Scores {public:  Scores(int maxEnt = 10);  // Constructor  ~Scores();            // Destructor  void add (const GameEntry& e); // add an entry  GameEntry remove(int i)    // Remove a single entry    throw (IndexOutOfBounds);  // Operators:  GameEntry& operator[](size_t i) {    return entries[i];  };    // Access to game entries  friend ostream& operator<<(ostream& out, const Scores& obj);private:  int maxEntries;       // maximum number of entries  int numEntries;       // actual number of entries  GameEntry* entries;       // array of game entries};// Definitions for ScoresScores::Scores(int maxEnt) {  maxEntries = maxEnt;  entries = new GameEntry[maxEnt];  numEntries = 0;}Scores::~Scores() {     // Destructor  delete [] entries;}void Scores::add(const GameEntry& e) { // Add a game entry  int newScore = e.getScore();         // Score to add  if (numEntries == maxEntries){       // The array is full    if (newScore <= entries[maxEntries-1].getScore())      return;           // not high enough  }  else    numEntries++;  int i = numEntries - 2;   // Start with the next to last  while (i >= 0 && newScore > entries[i].getScore()) {    entries[i+1] = entries[i];    i--;  }  entries[i+1] = e;}GameEntry Scores::remove(int i) throw(IndexOutOfBounds) { // Remove  try{    // Exception for outof bounds    if ( (i < 0) || (i >= numEntries) )      throw IndexOutOfBounds(Invalid index);  } catch (IndexOutOfBounds& iob) {    cout << iob.getMessage() << endl;    return GameEntry();  }  GameEntry e = entries[i];     // Save the removed object  for (int j = i+1; j < numEntries; j++)      entries[j-1] = entries[j];    // Shift entries left  numEntries--;         // one fewer entry  return e;         // return the removed object}ostream& operator<<(ostream& out, const Scores& obj){  for (int i = 0; i < obj.numEntries; i++) {    out << obj.entries[i] << ' ';  }  return out;}int main() {  GameEntry *e0 = new GameEntry(Zafar, 10);  GameEntry *e1 = new GameEntry(Zafa, 11);  // Scores *s = new Scores(5);  Scores s(5);  s.add(*e0);  s.add(*e1);  s.add(GameEntry(John, 9));  s.add(GameEntry(Alice, 19));  s.add(GameEntry(Bob, 15));  s.add(GameEntry(Connor, 1));  cout << s << endl;  s.remove(0);  s.remove(6);  cout << s << endl;}
Scorekeeper for a game
c++;object oriented;game
Using namespace stdThis is a common issue. Don't do it.Parameter namesYour parameter names to the GameEntry constructor aren't very illuminating. I would name them name_ and score_ to clarify the intent and avoid using the same name as your private fields.Pass by value if you will copyThe GameEntry constructor takes a const string& and copies it. If you have C++11 enabled, it can be more efficient if you take the string by value and then move from it:GameEntry::GameEntry(string n, int s)  : name(std::move(n)), score(s) {}Exception typesYou appear to be inventing your own exception types. This is unnecessary: the <stdexcept> header already includes a number of standard exception types, among which is std::out_of_range, which should be used in place of IndexOutOfBounds.Exception specificationsException specifications are deprecated as of C++11, and should not be used. This StackOverflow post provides some reasons why.Exception handlingThe only place you throw an exception, you immediately catch it and print a log statement. A better solution would be to throw the exception without catching it. This is better for several reasons:It is clear that an error has occurred. Printing an error message and returning an empty object does signal something has gone wrong, but an exception is a much better indicator.It forces the caller to handle the error. Index out-of-bounds is a serious logical error in a program, and needs to be dealt with by the caller. Failing fast makes it easier to identify and diagnose bugs.It allows the caller to handle the error however they want. Printing the error message inside remove() means the caller has no control over when and where the error is handled. It is very annoying (as a user) to have a function which will always print errors to the console, when I really want error messages silenced.