Circle
for storing the radius and calculating the area of a circle.
Cylinder
(which inherits all data members and member functions of class Circle
) for storing the radius (in base class Circle
) and height and calculating the area (surface area) and volume of a cylinder.
Circle
class, include this code for the value of Pi: static const double PI = 3.1415926;
Test Circle class constructor and area() function: Circle cir1: radius=10 area of cir1 = 314.159 Test set and get methods for class Circle: Circle cir2: radius=12 get data members for cir2: 12 Test Cylinder class constructor, area(), and volume() functions: Cylinder cyl1: radius=20 height=30 area of cyl1 = 6283.19 volume of cyl1 = 37699.1 Test set and get methods for class Cylinder: Cylinder cyl2: radius=40 height=50 get data members for cyl2: 40, 50
Click to validate the HTML code
Click to validate the CSS code