single colin ":" operator name?

Apr 28, 2008 at 1:56pm
Hopefully an easy question.

boxType::boxType(double l, double w, double h)
: rectangleType(l, w)
{
if (h >= 0)
height = h;
else
height = 0;
}

In that code, the class boxType is inheriting rectangleType. The above code is a constructor for boxType, that is passing l and w to it's base class rectangleType. Here is the question... what is the NAME used to refer to the single colin operator that is being used to call the rectangleType constructor?

Thanks
Apr 28, 2008 at 2:03pm
The single colon signifies the beginning of an initialization list. If boxType inherits rectangleType, it is calling the necessary constructor for rectangleType.
Apr 28, 2008 at 2:17pm
but what is the NAME used when I talk about the single colin?
Apr 28, 2008 at 2:28pm
It is the name of the base class that is being initialized.

ie, it is calling the following constructor:

rectangleType::rectangleType( double, double )
Apr 28, 2008 at 2:30pm
As far as I can tell, it was not given a name. It is simply used to delimit the beginning of an initialization list.
Topic archived. No new replies allowed.