how to do function like cout
-
Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's
-*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*
-
Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's
-*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*
-
Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's
-*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*
cout
is not a function.cout
is an object of a class calledbasic_ostream
. This class has overloaded theoperator <<
to accept many different data types as parameters likestring
,char*
,short
,long
etc.«_Superman_» _I love work. It gives me something to do between weekends.
-
Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's
-*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*
As correctly pointed out, the problem at hand is deriving your own stream class. Just entering that into a search on CP (using the tag "C++") gave me a list of articles, the third of which looked promising: audio_ostream - A Text-to-Speech ostream. If nothing else it's a working example with code.