Make codes the interface class pig

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

In this question, study the code of derived class "PetPig" bellow, then complete the tasks.

You have two tasks:

1. Make codes the interface class "Pig" with this ssumption "All of its member functions are overridden by member functions of PetPig Class". 

2. Make codes an abstract base class named "WildPig" publicly derived from the interface Pig. The WildPig class will have an integer type private data member named "m_danger_level". The WildPig class will only implement the display() public member function.  (7 marks)

#include <iostream> 
#include <cstring>
using namespace  std;
class PetPig : public Pig{
   char m_type[31];
public:
   PetPig(const char* type){
       strcpy(m_type, type);
   }
   void play(){
       cout << "Play like a pet pig " << endl;
   }
   void display(iostream& os)const{
       cout << m_type << " is a pet pig " <<endl;
   }
}

Reference no: EM133201568

Questions Cloud

Determine an element which has middle value : Create template function (a family of functions) named middleElement which receives three arguments of same type as reference objects. This function determines
Determine level and extent of monitoring for our business : Determine the level and extent of monitoring for our business: Are we legally allowed in Arizona to monitor employees smoking habits
Describe the most difficult-challenging part of logic : Without using code, describe the most difficult/challenging part of logic you coded. Provide a full detailed account of the process you took to overcome this ch
Why do firms build global development networks : 1. Why do firms build global development networks? 2. What has been their strategy? 3. How do Indian and U.S. RDCs fit into this strategy?
Make codes the interface class pig : In this question, study the code of derived class "PetPig" bellow, then complete the tasks.
Process of construction and eventual destruction : Consider how the object comes into its lifetime and how it ends. Use a code example if necessary, to illustrate your answer.
Construction and eventual destruction : Consider how the object comes into its lifetime and how it ends. Use a code example if necessary, to illustrate your answer.
Is bender entitled to dividends for 2010? for 2011 : Is Bender entitled to dividends for 2010? For 2011 and Is Bender entitled to a dividend of 10 percent rather than 8 percent in 2012
Why are financial markets essential for a healthy economy : MT 217 Delta State University. Why are financial markets essential for a healthy economy and economic growth? What are financial institutions?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program that utilizes a good design proces

Analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array one-dimensional..

  Write a driver program with a main method

Write a method named isPrime, which takes an integer as an argument and returns true if the argument is prime or false otherwise.

  Program that declares three single dimensional arrays

In the gallons array store the numbers 10.3, 15.7, 14.9, 10.7 and 8.4. Each element of the mpg array should be calculated as the corresponding element of the miles array divided by the equivalent element gallons array; for example mpg[0] = miles [..

  Individual genes are substrings of a genome

Individual genes are substrings of a genome delineated by 3-element start and stop codons. Genes begin with the start codon ATG and end with one of the following 3 stop codons: TAG, TAA or TGA. Note that start codons can appear anywhere in the string..

  Label object displaying the saying

Under the Format selection, include options of Font and Color. Wire the Font and Color options to the Windows predefined Font and Color dialog boxes so that when their values are changed, the text in the Label object displaying the saying is chang..

  Use a define statement to create a constant

Follow these specifications: Use a define statement to create a constant that will hold your student number. You should have separate string variables for your first and last name; name these first_name and last_name.

  Displays the information about the movie

researching constructors and dimensions. Can someone assist with explaining how to code such an example

  Write your own testing program to test the modified class

Write your own testing program to test the modified class - Doubly Linked List code to include index (rank) based access operations

  Compute the average of a subject

Compute the average of a subject (MATH, READING, or WRITING). Find the highest grade of a subject. Allow user to choose which subject to find its highest grade.

  Write a function template named display

Write a function template named display() that displays the value of the single argument passed to it when the function is called.

  Determines whether a given number is a perfect square

Write and test the following function that determines whether a given number is a perfect squarebool IsSquare(int);

  Create a class to hold credit card information

The information to store is the card type (Visa, Mastercard, etc.) card number, the limit, and the current balance.

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