c++ - Simple questions about cin/cout overloading 4 -
#include <iostream> #include <math.h> #include <conio.h> using namespace std; class hugeint { public: int size; int number[100]; friend istream& operator>>(istream&,hugeint&); friend ostream& operator<<(ostream&,hugeint&); }; istream& operator>>(istream& in,hugeint& c) { // code not shown return in; } ostream& operator<<(ostream& out,hugeint& c) { return out; } void main() { system( "color 70" ); hugeint o; hugeint y; hugeint z; cin >> o; cout<<"now y "<<endl; cin>>y; } the compiler complains operator >> ambigious... should ?
nope, the code compiles.
however please note did remove extraneous , non-c++ headers, , fixed incorrect main return type.
Comments
Post a Comment