Operator overloading MSVC++
I'm having trouble getting the following operator to overload. I want to take two inputs of type BMap24b and get either an int or a bool, depending on the recieving tupe. Any help would be appreciated.
Code:
public:
int operator &( BMap24b a, BMap24b b );
bool operator &( BMap24b a, BMap24b b );
int BMap24b:: operator&(BMap24b a, BMap24b b)
{
int counter = 0;
if( a.Color[0].i == b.Color[0].i )
{
counter += 0;
}
else {
if( a.Color[0].i > b.Color[0].i )
{
counter -= 1;
}
else {
counter += 1;
}
}
if( a.Color[1].i == b.Color[1].i )
{
counter += 0;
}
else {
if( a.Color[1].i > b.Color[1].i )
{
counter -= 1;
}
else {
counter += 1;
}
}
if( a.Color[2].i == b.Color[2].i )
{
counter += 0;
}
else {
if( a.Color[2].i > b.Color[2].i )
{
counter -= 1;
}
else {
counter += 1;
}
}
return( counter );
}
bool BMap24b:: operator&( BMap24b a, BMap24b b )
{
bool flag;
int i;
i = a & b;
if( i == 0 )
{
flag = 1;
} else {
flag = 0;
}
return( flag );
}
In the same program I have two Global CStrings, SrcFile and TrgtFile, I can't figure out how to write to them from a class that has the file with them included. Once again, any help would be appreciated.