Question: Write a class shapwrite a class shape having attributes sName, nsides,sColor.write a paremeterized constructor and getter function for getting the values of these attribute .Also
Write a class shapwrite a class shape having attributes sName, nsides,sColor.write a paremeterized constructor and getter function for getting the values of these attribute .Also write a function type() that return the type of shape.
Write a class triangle that inherit shape and have parameterized constructor and type()
Write a class polygon that inherit shape and have parameterized constructor and type()
in main() dynamically initialize that objects and to check above classes .Also create a pointer of base class and assign it the derived class object and call function via base pointer to check its behaviour.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
