I have code that compiles with no warnings on MSVC++ 6.0, and am trying to port it for a friend running the compiler in the Project Builder app for Mac OS. When he tries to compile, he gets an error
main.cpp:241: no match for `Bint& - Bint' operator
where I've indicated line 241 in the code below.
Here is the implementation of the function giving me problems:
Code:
bool Bint::operator~(void)
{
int digit;
for(int i=0;i<size;i++)
{
digit=digits[i];
Bint& temp=Bint(&digit,1,base);
*this=this->operator-(temp); //Subtract each digit, one at a time,
//from the number
}
if(size==2 && digits[0]==0) //Check for 0
return false;
return true;
}
Line 241 is the one beginning with *this=this...
Here is the class definition:
Code:
class Bint
{
public:
Bint(const char *init, int base);
Bint(void);
Bint&(Bint &init);
~Bint();
int GetSize(void) const {return size-1;};
Bint operator+(Bint &second) const;
Bint operator-(Bint &second) const;
Bint operator=(Bint &second);
bool operator~(void);
friend ostream& operator<< ( ostream& os, Bint num);
private:
Bint(const int *init, int size, int base);
int *digits;
int base;
int size;
};
Does anybody have any ideas what my mistake is?