Answer to Question #205893 in C++ for Alir

Question #205893

Sport management system project inheritance in code


1
Expert's answer
2021-06-11T17:03:06-0400

For example, look at the code below, and so on...

#include <iostream>

class Sport {
public:
  void win() 
  {
    std::cout << "Won!!!" << std::endl;
  }
  void score()
  {
    std::cout << "Scored!" << std::endl;
  }
};

class Football : public Sport {
public:
  void score()
  {
    std::cout << "Goooal!" << std::endl;
  }
};

class Boxing : public Sport {
public:
  void score()
  {
    std::cout << "Knockout!" << std::endl;
  }
};

int main()
{
  // implementation...
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment