Protected Data Members of class Shape such as: c_radius, s_area, s_length, s_width, t_base, t_height (int) c_area, t_are

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Protected Data Members of class Shape such as: c_radius, s_area, s_length, s_width, t_base, t_height (int) c_area, t_are

Post by answerhappygod »

Protected Data Members of class Shape such as:
c_radius, s_area, s_length, s_width, t_base, t_height (int)
c_area, t_area (float) pie = 3.1416 (const int)
Public Member Functions of class Shape such as:
void calculateArea() – It will print “Parent Class is generic,
your roll number and name”.
Inherited Data Members of class Circle such as: It will inherit
c_radius and c_area from shape class.
Public Member Functions of class Circle such as: void
calculateArea () –
It will take input c_radius and calculate area, store in c_area
and display area of the circle.
Inherited Data Members of class Square such as: It will inherit
s_length, s_width and s_area from shape class.
Public Member Functions of class Square such as:
void calculateArea () – It will take input s_length and s_width
and calculate area, store in s_area and display area of the
square.
Inherited Data Members of class Triangle such as: It will
inherit t_base, t_height and t_area from shape class.
Public Member Functions of class Triangle such as:
void calculateArea () – It will take input t_base and t_height
and calculate area, store in t_area and display area of the
triangle.
Create a UML diagram. Do the following operations in main
function:
1. Create a pointer object of class Shape and store the address
of the Circle class and call member function calculateArea().
2. Use a pointer object of class Shape and store the address of
the Square class and call member function calculateArea().
3. Use a pointer object of class Shape and store the address of
the Triangle class and call member function calculateArea().
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply