Cast expression

[C-style cast]

    The type of data to be converted in parentheses, is located in front of the operand values ​​to be converted. Because the cast operator in front of the operands, so that the conversion notation is referred to prefix notation,

        Examples are as follows:

            booksPerMonth = (double)books / months;

[Pre-standard C ++ type cast form]

    Before expression is to be converted data type in the operand whose value you want to convert, but it will put parentheses around operands, rather than around the data type. This conversion is known as functional notation representation,

        Examples are as follows:

            booksPerMonth = double(books) / months;

Guess you like

Origin www.cnblogs.com/zhao-wf/p/12006640.html