Answer to Question #274040 in C++ for manu

Question #274040

Write a program to print the volume of a box by creating a class named 'Volume' with an initialization list to initialize its length, breadth and height. (just to make you familiar with initialization lists) 


1
Expert's answer
2021-12-04T10:42:23-0500
class Box {
public:
  Box(double x, double y, double z)
   : length(x), breadth(y), height(z) {}
  
  double volume() const { return lenght * breadth * height; } 

private:
  double length;
  double breadth;
  double height;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Saddat Kabir
14.10.22, 08:55

your team is excellent

Leave a comment