#include <iostream>
using namespace std;
class MyClass {
double l, w, h;
double volume;
public:
MyClass(double a, double b, double c);
void vol();
};
MyClass::MyClass(double a, double b, double c)
{
l = a;
w = b;
h = c;
volume = l * w * h;
}
void MyClass::vol()
{
cout << "Volume is: " << volume << endl;
}
int main()
{
MyClass x(2.2, 3.97, 8.09), y(1.0, 2.0, 3.0);
x.vol();
y.vol();
return 0;
}
|