Implicit type conversion: Difference between revisions

Content added Content deleted
(Added C++ implementation)
m (C++)
Line 222: Line 222:


=={{header|C++}}==
=={{header|C++}}==
C++ supports almost all of the same implicit conversions as the C example above. However it does not allow implicit conversions to enums and is more strict with some pointer conversions. C++ allows implicit conversions on user defined
C++ supports almost all of the same implicit conversions as the [[Implicit_type_conversion#C|C]] example above. However it does not allow implicit conversions to enums and is more strict with some pointer conversions. C++ allows implicit conversions on user defined
types. The example below shows implicit conversions between polar and Cartesian points.
types. The example below shows implicit conversions between polar and Cartesian points.
<lang cpp>#include <iostream>
<lang cpp>#include <iostream>