Parameterized Constructors
Although the box () constructor in the preceding instance does initializes a box object, it is not extremely useful- all boxes have the similar dimensions. What is required is a way to construct box objects of several dimensions. The simple solution is to add parameters to the constructor. This makes them much more useful as you can probably guess. For instance, the following version of box describes a parameterized constructor that sets the dimensions of a box as specified through those parameters. They pay special attention to how box objects are being created.
class box {
double width, height, depth;
box(double w, double h, double d)
{
width = w;
height = h;
depth = d;
}