I was making a class for Complex Numbers.
I want to know one thing though.
Say I create a class Complex_t.
It has a string Num. It will store the Complex Number as A + Bi where A and B are two values I put in it through a string stream.
I have an object Complex, of type Complex_t.
My question is this:
cout << Complex;
Is there a way to make it such that it will print Num from Complex?
I have tried overloading << operator, but it didn't work!
/* NOTE: Not part of your class, that's why you need the friend statement: */
ostream @operator << ( ostream &Out, const Complex_t &C )
{
Out << C.Num.data();
return Out;
}
/* operator << */