Computer Science, asked by PragyaTbia, 1 year ago

Show the output of the following program
// derived classes
#include
usingnamespacestd;

classCPolygon {
protected:
int width, height;
public:
voidset_values (int a, int b)
{ width=a; height=b;}
};

classCRectangle: publicCPolygon {
public:
int area ()
{ return (width * height); }
};

classCTriangle: publicCPolygon {
public:
int area ()
{ return (width * height / 2); }
};

int main () {
CRectanglerect;
CTriangletrgl;
rect.set_values (4,5);
trgl.set_values (4,5);
cout< cout< return 0;
}

Answers

Answered by Arslankincsem
0

C++ programming questions and answers focus on “Multiple Inheritance.”


One shall practice these problems to develop their C++ programming professions required for many interviews (campus interviews, walk-in interviews, company transcripts), placements, admission exams, and different competing exams.


These problems can be tried by anyone concentrating on learning C++ programming language.


They can be a freshman, fresher, engineering bachelor or an accomplished IT professional.


Our C++ programming puzzles begin with a full analysis of the solutions which helps in reliable knowledge of C++ concepts. include link


Similar questions