Consider the following statement:
Time *timePtr = new Time();
The new
operator allocates storage of the proper size for an object of type Time
, calls the default constructor to initialize the object and returns a pointer to the type specified to the right of the new
operator (i.e., a Time *
). If new
is unable to find sufficient space in memory for the object, it indicates that an error occurred by throwing an exception.
18.191.200.105