본문 바로가기

Language Proficiency/C++

Box It!

Design a class named Box whose dimensions are integers and private to the class. The dimensions are labelled: length , breadth , and height .

The default constructor of the class should initialize , and  to .

The parameterized constructor Box(int length, int breadth, int height) should initialize Box's  and  to length, breadth and height.

The copy constructor BoxBox ) should set  and  to 's  and , respectively.

Apart from the above, the class should have  functions:

  • int getLength() - Return box's length
  • int getBreadth() - Return box's breadth
  • int getHeight() - Return box's height
  • long long CalculateVolume() - Return the volume of the box

Overload the operator  for the class BoxBox   Box  if:

  1.  < 
  2.  <  and ==
  3.  <  and == and ==

Overload operator  for the class Box()
If  is an object of class Box:

 should print  and  on a single line separated by spaces.

Constraints

 
Two boxes being compared using the  operator will not have all three dimensions equal.





'Language Proficiency > C++' 카테고리의 다른 글

C++ Variadics  (0) 2018.08.06
C++ Class Template Specialization  (0) 2018.08.06
Classes and Objects  (0) 2018.08.06
Class  (0) 2018.08.06
Bit Array  (0) 2018.08.03