Professional Documents
Culture Documents
Overloading of Stream Function Basic To Class Type Conversion
Overloading of Stream Function Basic To Class Type Conversion
Overloading of Stream Function Basic To Class Type Conversion
FUNCTION
&
BASIC TO CLASS TYPE
CONVERSION
C++ allows input and output of built-in data types using stream extraction operator >>
and the stream insertion operator <<.
The capabilities of these operators can be extended to perform input and output for
user-defined types.
cin is an object of istream class & cout is an object of the stream class.
OUTPUT
OUTPUT
TYPE
CONVERSION
In this type of conversion the source type is basic type and the destination type is class
type. Means basic data type is converted into the class type.
The conversion from basic type to the class type can be performed by two ways:
i. Using constructor
ii. Using Operator Overloading
OUTPUT
OUTPUT