Write a program that declares two classes. The parent class is called Shape that has two data members num1 and num2 to store two numbers. It also has four members functions. The setarea() function set the area and displays the result. The getarea() function get the area and displays the result. The setdraw() function set the coordinates for draw and displays the result. The getdraw() function get the coordinates for draw and displays the result. The child class is called Circle 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. All the possible exception is handle through exception handling. give code with c++

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Write a program that declares two classes. The parent class is called Shape that has two data members num1 and num2 to store two numbers. It also has four members functions.

  • The setarea() function set the area and displays the result.
  • The getarea() function get the area and displays the result.
  • The setdraw() function set the coordinates for draw and displays the result.
  • The getdraw() function get the coordinates for draw and displays the result.

The child class is called Circle 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. All the possible exception is handle through exception handling.

give code with c++

Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT