Question: writing a C++ program based on Object Oriented Programming as outlined below. Each Print function should print the class name and the datatype of parameter.

writing a C++ program based on Object Oriented Programming as outlined below.

Each Print function should print the class name and the datatype of parameter.

In the OutStream: Char Print function: x

In the SubOutStream: Char Print function: x

A superclass called OutStream with the following member functions that are

virtual void print(char value) = 0 // prints a char value and OutStream

virtual void print(int value) {...} // prints an int value and OutStream

virtual void print(short value) {...} // prints a short and OutStream

void print(long value) {...} // prints a long value and OutStream

A subclass called SubOutStream that inherits the OutStream class. Its member function must include:

void print(char value) {...} // prints a char value and SubOutStream

void print(short value) {...} // prints a short and SubOutStream

void print(long value) {...} // prints a long value and SubOutStream

void print(float value) {...} // prints an float value and SubOutStream

void print(double value) {...} // prints an double value and SubOutStream

Test your program with your own data, but you must implement and successfully test the two classes using the polymorphism types. Create example in main to test each type of casting below.

Hint: Using Pointers

Class Implicit Casting

Class Implicit Casting with Dynamic Objects

Class Explicit Casting

Class Explicit Casting with Dynamic Objects

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!