

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Write a program that has an abstract base class named Quad. This class should have for member data variables (floats) representing side length and a pure virtual function Area. It should also have a method for setting the data variables. Derive a class Rectangle from Quad and override the Area method so that it returns the area of the Rectangle. Write a main function that creates a Rectangle and sets the side lengths. Also, write a toplevel function that will take a parameter of type Quad and r
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Q.1 (Marks 5) Write a program that has an abstract base class named Quad. This class should have four member data variables (floats) representing side length and a pure virtual function Area. It should also have a method for setting the data variables. Derive a class Rectangle from Quad and override the Area method so that it returns the area of the Rectangle. Write a main function that creates a Rectangle and sets the side lengths. Also write a toplevel function that will take a parameter of type Quad and return the value of the appropriate Area function.