1.

What Is Implicit Conversion/coercion In C++?

Answer»

Implicit conversions are performed when a type (say T) is used in a CONTEXT where a COMPATIBLE type (Say F) is expected so that the type T will be promoted to type F.
short a = 2000 + 20;
In the above example, variable a will get AUTOMATICALLY promoted from short to INT. This is called implicit conversion/coercion in c++.

Implicit conversions are performed when a type (say T) is used in a context where a compatible type (Say F) is expected so that the type T will be promoted to type F.
short a = 2000 + 20;
In the above example, variable a will get automatically promoted from short to int. This is called implicit conversion/coercion in c++.



Discussion

No Comment Found