C++ Write the DECLARATION of a class pet as follows: (HINT: you must INCLUDE this in another file) Data member variables: species, weight, age Functions: default constructor, constructor with...






C++



  1. Write the DECLARATION of a class
    pet
    as follows: (HINT: you must INCLUDE this in another file)


Data member variables: species, weight, age





    1. Functions: default constructor, constructor with parameters to set all variables, print, set species, set age, set weight.

    2. Be sure to include any necessary include and using directives.




2. Write the DEFINITION/IMPLEMENTATION (write the code) of the class
pet
declaration in Question 1.



  1. Write the code to
    implement (write the code for)
    the functions in the class
    pet.

  2. Be sure to include all using, includes and other directives necessary to complete the code.



3. Extend
the
pet
class to include the following data members and functions i.e.,
INHERITANCE.
DEFINE AND IMPLEMENT
(write the code for) the extended class. Class will represent a pet of type
Canine.



  1. Member variable
    name
    (i.e., pet name),
    color.

  2. Include member function includes, prototypes (declaration) and code (definition): all constructor(s), set
    color,
    set
    name
    and print to extend the base class
    pet.

  3. Create an object of the
    inherited
    class that sets
    all
    member variables to values of your choice, i.e., use the extended class as you would in a test/client program. You do not need to write any other code in the test/client.


4. Consider the pet and extended pet classes written in the previous questions:



  1. Write the
    PROTOTYPE
    for a function that overloads the + (plus) operator to add a value (i.e., 1) to the age data member in the
    extended/inherited pet object. Write as a
    member
    function.

  2. Write the
    PROTOTYPE
    for a function that overloads the < (insertion)="" operator="" to="" print="" an="" object="" of="">
    extended/inherited pet object.

  3. Write the code to create one
    extended/inherited pet
    object. Write the line of code to add 1 to the age using the overloaded + (plus) operator.

  4. Write the line of code to print the
    extended/inherited pet
    object using the overloaded < (insertion)="">


You do not need to write any code for the
functions, just the prototypes.


You
do
need to create and objects of of the
inherited
pet class and write the code for c and d to represent using the prototypes created in a and b.


You do not need to write any #include objects, main or function calls. Do not worry about setting any values for the data members.
Assume
any base get functions exist, if needed





Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here