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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started