Course Solutions Uncategorized (Solved) : C Use Abstract Class Shape Define Twod Shape Add Functionalities Methods Define Instances Q34451437 . . . .

(Solved) : C Use Abstract Class Shape Define Twod Shape Add Functionalities Methods Define Instances Q34451437 . . . .

 

C++

Use the abstract class shape to define TwoDshape and add all the functionalities to the methods.

Define the instances triangle, square and rectangle in thedriver class to test the functionality of the TwoDclass you have extended from the shape class.

CLARIFICATION:

TwoD is to be inherited from Shape class. And TwoD class methodscan be changed or we can add new methods to differentiate betweenrectangle and a triangle based on the number of sides.

#include

using namespace std;

template

// shape is square

class shape

{

T side;

public: int getSide()

{

return side;

}

bool setSides(T s)

{

if(s > 0)

{

side = s;

return true;

}

else

return false;

}

T getArea()

{

return side*side;

}

T getPerimeter()

{

return side*4;

}

void display()

{

cout<<“Side: “<

cout<<“Area: “<

cout<<“Perimeter: “<

}

};

int main()

{

shape S1;

int num1;

cout<<“Enter side(integer):

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Kaneva Start Company Built Virtual World Empower Community Customers Create Realities Desp Q34245496Kaneva Start Company Built Virtual World Empower Community Customers Create Realities Desp Q34245496

a,.chgg-hdr-navigation .nav-item.moreitems-item .links-section>a{display:none}.chgg-hdr-navigation .nav-item-pipe{height:100%;width:1px;cursor:initial}.chgg-hdr-navigation .nav-item-pipe:before{content:"";background-color:#000;display:block;position:absolute;top:0;left:0;height:22px;width:1px;padding:0;margin:18px 0;overflow:hidden}.chgg-hdr-navigation .nav-items{height:60px;display:none}.chgg-hdr.type-books .chgg-hdr-navigation .nav-items.books,.chgg-hdr.type-flashcards .chgg-hdr-navigation .nav-items.flashcards,.chgg-hdr.type-home .chgg-hdr-navigation .nav-items.home,.chgg-hdr.type-internships .chgg-hdr-navigation .nav-items.internships,.chgg-hdr.type-mathsolver .chgg-hdr-navigation .nav-items.mathsolver,.chgg-hdr.type-scholarships .chgg-hdr-navigation .nav-items.scholarships,.chgg-hdr.type-study .chgg-hdr-navigation .nav-items.study,.chgg-hdr.type-testprep .chgg-hdr-navigation .nav-items.testprep,.chgg-hdr.type-tutors .chgg-hdr-navigation .nav-items.tutors,.chgg-hdr.type-writing .chgg-hdr-navigation .nav-items.writing{display:inline-block}.chgg-hdr-navigation .nav-hover-box{display:none;position:fixed;background-color:#FFF;border-radius:4px;border:1px solid #DDD;margin-left:-20px;cursor:auto;z-index:1000}.chgg-hdr-navigation