CSE 100 Lecture Notes - Lecture 6: Type Conversion, Standard Error
Document Summary
Cse 100 lecture six notes: type conversions, input and output with characters and strings, etc. A method for converting different data types from one form to another. Short x = 350; int y; y = x; This conversion is completed without the use of explicit converters. Class a {}; class b { public: b (a a) {} }; Pointers to any type can be converted to void pointers. Some conversions imply a loss of precision which can trigger a warning. Can be avoided with an explicit conversion. Can also include constructor or operator conversions. Can be applied indiscriminately on classes and pointers to classes. Traditional methods allow to convert any pointer into another pointer type. In order to control conversions between classes, there are four types of conversions. Short x = 350; int y; y = (int) x; y = int (x); Can only be used with pointers and references to objects.