Program to implement run time polymorphism using C++
Facing doubts while preparing for Diploma Computer exams? Searching for a solution to a program to implement run time polymorphism using C++? Check out this page where our ISC experts shall provide answers for your query.
This question is asked for 4 marks and hence requires some explanation along with program code. Please let me know the solution.
Q) Create class shape. Derive two classes Triangle and Rectangle. Accept dimensions of Triangle and Rectangle with appropriate functions. Make area() function virtual which is common to all classes. With area function calculate area of triangle and rectangle. Display the result.[4 Marks]