Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C + + program example to show how dynamic binding works when implemented in a program to choose a game to play. This program is

C++ program example to show how dynamic binding works when implemented in a program to choose a game to play. This program is NOT about playing a games but rather helping users find the best game that is right for them given the skill level (if age appropriate), genre, type (computer, board, card, etc.) and other
criteria. Create a base class Game as an abstract base class and three derived classes (only implement two/one depending on whats necessary to show how theyd be the same/different). Three classes are BoardGame, YardGame, and VideoGame. There is also a Node class with a base pointer that will be used to implement a data structure later. Things all three derived classes have in common should be base class members. Other than
constructors, destructors, setters, display, etc., there should be 3 functions that
are the same from the user perspective for each derived game class.
Remember this program isnt about playing the games but rather helping users
decide what games would be the best fit. It will be important to pick three
functions and implement them in the derived classes the idea is that they have
exactly the same return type, same name, and same arguments but the
implementation in the function body is different. In addition, incorporate RTTI to show how to work with the different derived characteristics (i.e., functionality is not self similar). In only ONE derived class, include one method that is different, which is not virtual in the base class, and how it is called with the dynamic_cast operation demonstrating downcasting. Use strings (no char *), exception handling for handling erroneous situations, and smart pointers (limit your raw pointers). Also use the STL (vector, list , array) whenever a collection of data is required (besides data structure that will be implemented later).
Data members to include:
- Name (e.g., Minecraft)
- Genre (e.g., Sandbox, sub genres are Survival and Adventure)
- Skill Level (e.g., appropriate age range)
- Number of Players (how many needed to play, whats the max, is it good for groups?)
- At least two unique characteristics about a game that is not common (such
as if there are cards, a board, dice, avatars, game level, etc.).
- Pick one other that would be helpful for determining if game is a good match for what theyre looking to play.
FULLY IMPLEMENT main/how user would enter input and how that input would be used to create the right derived class objects or call the right functions. Do NOT just lump in the base class functionality into main. Please separate them.
FULLY IMPLEMENT these functions for the base class AND a derived class, so I can see their relationship and an example of proper implementation:
virtual bool ageAppropriate(int age) const =0;
virtual bool matchesGenre(const std::string& desiredGenre) const =0
virtual std::string getRecommendedGames() const =0;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago