Write a program in C++ that declares two classes. The parent class is called Simple that has two data members num1,num2 to store two numbers. It also has four member functions. The add() function adds two numbers and displays the result. The sub() function subtracts two numbers and display the result. The mul() function multiplies two numbers and display the result. the div () function divides two numbers and display the result. The child class is called Complex that overrides all four functions, each function in the child class checks the value of data members. it calls the corresponding member function in the parent class if the values are greater than 0. Otherwise it displays error message.
Write a
The child class is called Complex that overrides all four functions, each function in the child class checks the value of data members. it calls the corresponding member function in the parent class if the values are greater than 0. Otherwise it displays error message.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images