Overloading << and >> in C++ to perform decimal shifts -


i trying overload << , >> operators perform decimal shifts, i'm not seeing how that. example, i'll have member function of class myclass

myclass myclass::operator<<(myclass ob2) {     //code in here overloading <<     //in object, there float value perform shift on } 

any appreciated! thanks!!!

presumably "decimal shift" means shifting decimal point left (right, operator>>) specified number of digits.

in case, want parameter unsigned int:

myclass &myclass::operator<<(unsigned digits) {       value *= pow(10, digits);      return *this; } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -