Advertisement
daniil_mironoff

Untitled

Jul 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1.  
  2. class Box {
  3.     private:
  4.         int l;
  5.         int b;
  6.         int h;
  7.  
  8.     public:
  9.         Box() : l(0), b(0), h(0) {}
  10.         Box(int len, int brd, int hgt) : l(len), b(brd), h(hgt) {}
  11.  
  12.         Box(Box& obj) : l(0), b(0), h(0) {
  13.             l = obj.l;
  14.             b = obj.b;
  15.             h = obj.h;
  16.         }
  17.  
  18.         int getLength() {
  19.             return l;
  20.         }
  21.  
  22.         int getBreadth() {
  23.             return b;
  24.         }
  25.  
  26.         int getHeight() {
  27.             return h;
  28.         }
  29.  
  30.         int CalculateVolume() {
  31.             return l * b * h;
  32.         }
  33.  
  34.         bool operator < (Box& obj) {
  35.             if (CalculateVolume() < obj.CalculateVolume()) {
  36.                 return true;
  37.             } else {
  38.                 return false;
  39.             }
  40.            
  41.         }
  42.  
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement