C Problem Comp Sci Ii Class Class Shape Public Void Setdim Double Double 0 Virtual Void Sh Q37072898

THIS IS C++ PROBLEM FOR MY COMP SCI IICLASS

class Shape {

public:

void setDim(double, double = 0);

virtual void showArea();

protected:

double x, y;

};

setDim(double xx, double yy) {} //Write setDim here to setdimensions x and y

// Derived class Triangle from Shape

class Triangle : public Shape{

public:

virtual void showArea();

};

// Derived class Rectangle from Shape

class Rectangle : public Shape{

public:

virtual void showArea();

};

// Derived class Circle from Shape

class Circle : public Shape{

public:

virtual void showArea();

};

//Write driver and call object of each shape

int main(){}


Answer


#include <iostream>using namespace std;class Shape {public: void setDim(double, double = 0); virtual void showArea();protected: double x, y;};void Shape::setDim(double

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.