Question: Write a class named 'cylinder' that inherits from the 'circle' and 'rectangle' classes. The 'cylinder' class must not have any member data. All member functions

 Write a class named 'cylinder' that inherits from the 'circle' and

Write a class named 'cylinder' that inherits from the 'circle' and 'rectangle' classes. The 'cylinder' class must not have any member data. All member functions of the 'cylinder' class will be located in the 'public' section. The member functions to be defined are explained below. I. The 'write size' function will take two real numbers (floats) as parameters. The first parameter should be the height of the cylinder and the second parameter should be the radius of the cylinder (r). ii. The 'find surface area' function will return the surface area of the cylinder. iii. The 'find volume' function will return the volume of the cylinder. (base area x height). iv. The '++' operator will increase the cylinder height by 1.

#include #include #define pi 3.14285 NMON 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 struct dims { float length, height; } class rectangle { private: float length, height; protected: dims getDim() { dims d; d.length = length; d.height = height; return(d); } float getArea(){ return (length * height); } void setDim(float len, float hei) { length = len; height = hei; = NN EHHHHH to co W NOCO GO WEB = 24 - mmmmmmmm 25 26 27 28 29 30 31 32 33 34 35 36 371 38 39 40 41 42 43 }; class circle { private: float rad; float getDim() { return(rad); } protected: float circumference(){ return (2*pi*rad); } float getArea() { return (pi*rad*rad); } float setDim(float r){ rad=r; } }; = 9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!