The basic elements of the Operator programming language, which makes our code more concise and straightforward. However, in order to solve the problem of different types of operands, we have introduced the concept of forced conversion. Let's look at
[Understanding C ++ (1)] type conversion (Type Casting)
Luo chaohui (http://www.cnblogs.com/kesalin/
)
CC license. For more information, see Source
Type conversion is to convert the expression of the given type to another type. There are
C language Type castingCoercion of type conversions is accomplished through type conversion operations. Its general form is: (type specifier) (an expression) whose function is to cast the result of an expression into a type that is represented by
About the C language pointer type cast reference an article:In C, any variable must occupy an address, and the 0-1 code in that address space is the value of the variable. Different data types occupy varying sizes of space, but they all have to have
Type conversion Maybe everyone is not strange, int i; float J; j = (float) i; i = (int) J; Explicit conversions like this are very common, forcing type conversions may lose some of the data, so if you do not add (int) to do the cast, strict
operatorThe operator keyword is used to declare an operator in a class or struct declaration. An operator declaration can take one of the following four forms:
public static result-type operator Unary-operator (op-type operand)
public
MSDN Reference: Http://msdn.microsoft.com/zh-cn/library/s53ehcz3.aspx http://msdn.microsoft.com/zh-cn/library/ z5z9kes2.aspx the Http://msdn.microsoft.com/zh-cn/library/xhbhezf4.aspxoperator keyword to overload a built-in operator, or to provide a
An article from cplusplus.com, which is the most comprehensive, meticulous, and in-depth article I have seen about C + + type conversion. This article describes the various types of C + + conversions, including: implicit type conversion of basic
Type conversions are essentially type casting, or the conversion of data from one type to another. There are two forms of type casting in C #:
implicit type conversions -These transformations are the default, safe conversion of C #, and do
In C + +, there is a type conversion, which usually means a flaw (not absolute). So, for type conversions, there are several principles:(1) Try to avoid type conversions, including implicit type conversions(2) If a type conversion is required, use
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.