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
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