single colin ":" operator name?
| kbarrett (13) | |||
| 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 | |||
| rpgfan3233 (111) | |||
| The single colon signifies the beginning of an initialization list. If boxType inherits rectangleType, it is calling the necessary constructor for rectangleType. | |||
| kbarrett (13) | |||
but what is the NAME used when I talk about the single colin? | |||
| jsmith (958) | |||
| It is the name of the base class that is being initialized. ie, it is calling the following constructor: rectangleType::rectangleType( double, double ) | |||
| rpgfan3233 (111) | |||
| As far as I can tell, it was not given a name. It is simply used to delimit the beginning of an initialization list. | |||
This topic is archived - New replies not allowed.
