how does ofstream or ostream type cast all types to string?

前端 未结 4 1765
庸人自扰
庸人自扰 2021-01-14 07:20

any system defined user type past to ostream object is converted to a string or char* ?

like cout<<4<<\"Hello World\";

works perfectly fine, how

4条回答
  •  灰色年华
    2021-01-14 08:08

    an i have just one overloaded operator method with one parameter(like void*) and then decide inside that method how to typecast integer to char*

    No, you can't. A void * carries no type information, so there is no way of working out what type it actually points to.

提交回复
热议问题