Question: 2. (4 points) The definition of the Square class defined in the text book is given below. Modify this Square class to define a class


2. (4 points) The definition of the Square class defined in the text book is given below. Modify this Square class to define a class for a Block (cuboid) with the dimensions length, width, and height, stored as data members. Write all the data members and the methods that correspond to the square class given below. Do NOT write the following methods, but assume that they exist and available for use: getWidth(), getHeight(), setLength(), setWidth(), setHeight(), Block( ), and Block(Block && rhs). And do write only the following methods: a) constructor Block( double len, double wid, double ht), b) copy constructor Block(const Block & rhs) c) mutator method setLength(), d) accessor method getLength(), e) print(), f) getVolume(), (where volume = length*width*height), and g) operator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
