Add a non member function

Assignment Help C/C++ Programming
Reference no: EM13166113

For the code below add the following. Add a non member function that will run the show function of a Sport object. This object is the one parameter of the function. Make the necessary changes so that when an object of BallSport is the parameter of the function, it will show the correct output (using polymorphism).

#include <iostream>
#include <string>
using namespace std;

class Sport
{
public:
Sport()
{
kind = "who knows";
}
void show()
{
cout << "this is " << kind << endl;
}
private:
string kind;
};

class BallSport : public Sport
{
public:
void set(string bt)
{
balltype = bt;
}
void show()
{
cout << "this is " << balltype << "ball\n";
}
private:
string balltype;
};

int main()
{
return 0;
}

Reference no: EM13166113

Questions Cloud

Where s is any string : Write a function detab(s, stop), where s is any string, and stop is a positive integer called tabstop size. This function should return a string which is like s.
Write a dissociation equation of alcl3 : Write a dissociation equation of AlCl3 showing its sepatation into aqueous ions.
State what is the absolute error in pka according to pka : What is the absolute error in pKa according to pKa from the mid-point pH value? The true value is given in # (5) (9) What is the relative % error in pKa according to pKa from the mid-point pH value?
Find a number alpha mod 8745437489 is not a primitive root : using a computer, show that 7 is a primitive root mod 8745437489. Find a number alpha mod 8745437489 that is not a primitive root
Add a non member function : For the code below add the following. Add a non member function that will run the show function of a Sport object. This object is the one parameter of the function.
What is the partial pressure of each gas : A sample of gas is made entirely of carbon dioxide and water, and there are 259 moles of carbon dioxide and 513 moles of water. If the total pressure of the sample is 21 atm, what is the partial pressure of each gas?
Calculate the concentration of ammonium ions : A solution is prepared by dissolving 11.5 g ammonium sulfate in enough water to make 100.0 mL of stock solution. A 10.00 mL sample of this stock solution is added to 52.00 mL of water. Calculate the concentration of ammonium ions and sulfate ions ..
Make a power table for numbers mod 11 : Make a power table for numbers mod 11. Indicate how the table shows Fermat's theorem, label the primitive roots mod 11. Explain how you can tell they are primitive roots. Label the rows that make good power ciphers and explain
Calculate the volume of required to reach equivalence point : 60.0 mL of a 0.450 M solution is titrated with 0.570 M . Calculate the volume of required to reach the equivalence point.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd