You can set a breakpoint on a class's constructor or a destructor (unless they are inline functions). The breakpoint is taken whenever an object of that class is created or destroyed. You can specify a breakpoint that halts execution so that you can examine your program's status. You can also specify a breakpoint that executes a command, such as displaying a message in the Command window or incrementing a counter, and then continues execution. This technique is especially useful for monitoring the creation and destruction of temporary objects created by the compiler.
You cannot call a constructor or destructor for an object, either explicitly or implicitly, by using an expression that calls for construction of a temporary object. For example, the following illegal command explicitly calls a constructor and results in an error message:
>? Date( 2, 3, 1985 )
You cannot call a conversion function if the destination of the conversion is a class because such a conversion involves the construction of an object. For example, suppose that myFraction is an instance of the Fraction class, which defines the conversion function operator FixedPoint. The following command results in an error:
>? (FixedPoint)myFraction
However, you can call a conversion function if the destination of the conversion is a built-in type. For example, suppose that the Fraction class defines a conversion function named operator float. The following command is legal:
>? (float)myFraction
You can also call functions that return an object or that declare local objects.
You cannot call the new or delete operators. The command
? pDate = new Date(2,3,1985)
is illegal and CodeView displays an error message.