Home Segments Index Top Previous Next

422: Mainline

From the data-type perspective, new internally generates a pointer which is said to be of type void*. Such pointers have the property that they can be cast into pointers of any type.

Then, if the new expression is new double, the void* pointer is cast automatically into a object of type double*, which is a pointer a double object. Analogously, if the new expression is new cylinder, the void* pointer is cast automatically into a pointer to an object of type cylinder*, which is a pointer to a cylinder object.