Quiz 2
Quiz 2
Question 1: Analyze the given code, identify and correct any errors present, and provide the
output after the corrections.
#include <iostream>
using namespace std;
class Shape {
public:
double area() const = 0;
void print() const = 0;
};
class Rectangle : public Shape {
private:
double length;
double width;
public:
Rectangle(double l, double w);
public:
Square(double s);
int main() {
Rectangle rectangle(5, 8);
Square square(4);