S
Skybuck Flying
Hello,
Visual Studio .Net 2005 (Win32) Compile error:
Error 1 error C2804: binary 'operator +' has too many parameters <snipped>
line 16
class TSkybuckInt32
{
private:
int mInteger;
public:
// constructor with initializer parameter
TSkybuckInt32( int ParaValue );
// binary arithmetic add operator overloader
// adds A and B together and returns a new C
TSkybuckInt32 operator+( const TSkybuckInt32& A, const
TSkybuckInt32& B );
void Display();
};
// constructor
TSkybuckInt32::TSkybuckInt32( int ParaValue )
{
mInteger = ParaValue;
}
// binary arithmetic add operator overloader
TSkybuckInt32 TSkybuckInt32:perator + ( const TSkybuckInt32& A, const
TSkybuckInt32& B);
{
TSkybuckInt32 C;
C.mInteger = A.mInteger + B.mInteger;
return C.mInteger;
}
TSkybuckInt32:isplay()
{
cout << mInteger << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
TSkybuckInt32 A;
TSkybuckInt32 B;
TSkybuckInt32 C;
A = TSkybuckInt32( 30 );
B = TSkybuckInt32( 70 );
C = TSkybuckInt32( 0 );
C = A + B;
C.Display();
return 0;
}
What's wrong ?
Bye,
Skybuck.
Visual Studio .Net 2005 (Win32) Compile error:
Error 1 error C2804: binary 'operator +' has too many parameters <snipped>
line 16
class TSkybuckInt32
{
private:
int mInteger;
public:
// constructor with initializer parameter
TSkybuckInt32( int ParaValue );
// binary arithmetic add operator overloader
// adds A and B together and returns a new C
TSkybuckInt32 operator+( const TSkybuckInt32& A, const
TSkybuckInt32& B );
void Display();
};
// constructor
TSkybuckInt32::TSkybuckInt32( int ParaValue )
{
mInteger = ParaValue;
}
// binary arithmetic add operator overloader
TSkybuckInt32 TSkybuckInt32:perator + ( const TSkybuckInt32& A, const
TSkybuckInt32& B);
{
TSkybuckInt32 C;
C.mInteger = A.mInteger + B.mInteger;
return C.mInteger;
}
TSkybuckInt32:isplay()
{
cout << mInteger << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
TSkybuckInt32 A;
TSkybuckInt32 B;
TSkybuckInt32 C;
A = TSkybuckInt32( 30 );
B = TSkybuckInt32( 70 );
C = TSkybuckInt32( 0 );
C = A + B;
C.Display();
return 0;
}
What's wrong ?
Bye,
Skybuck.