I have to write a class for a new "home-made" string class, and I do not know how to attack the operator>> . I will provide my class constructor and what i tried...
String::String( const char A[] )
{
char X = A[0];
int pos = 0;
Length = 0;
while (X!='\0')
{
Length++;
pos++;
X = A[pos];
}
Capacity = 16;
while (Length > Capacity)
{
Capacity+=16;
}
Mem = new char[Capacity];
for (unsigned I=0; I<Length; I++)
{
Mem[I] = A[I];
}
}
istream& operator>>( istream& In, String& A )
{
char X[128];
In >> X;
if(In.good())
{
A = X;
}
return In;
}
the simple thing I am trying to do is...
String C;
cin >> C;