can anyone help me with this one? i am getting a syntax error that reads like this:
lab2aa.C: In member function `bool IntArray::operator==(const IntArray&)
const':
lab2aa.C:80: syntax error before `}' token

my size() method works (tested it before i put in these operator things) ...

and self is *this in an include file ... TRUE and FALSE are true and false respectively in the include file, too.

what am i missing here?

bool IntArray::
operator == ( const IntArray &rhs ) const
{
        if ( size() != rhs.size() ) {
                return ( FALSE ); 
        }
        int i = 0;
        while ( i < size() ){
                if ( self[i] != rhs[i] ){                      
                        return ( FALSE );
                }
                else i++
        }
        return ( TRUE );
}

thanks!!

charity

Recommended Answers

All 2 Replies

oh, and there is this one too ... they both call each other. i am getting the same syntax error in both.

bool IntArray::
operator != ( const IntArray &rhs) const
{
        if ( size() == rhs.size() ) {
                return ( FALSE );
        }
        int i = 0;
        while ( i < size() ){
                if ( self[i] == rhs[i] ){ 
                        return ( TRUE );
                }
                else i++
        }
        return ( FALSE );
}

can anyone help me with this one? i am getting a syntax error that reads like this:
lab2aa.C: In member function `bool IntArray::operator==(const IntArray&)
const':
lab2aa.C:80: syntax error before `}' token

my size() method works (tested it before i put in these operator things) ...

and self is *this in an include file ... TRUE and FALSE are true and false respectively in the include file, too.

what am i missing here?

bool IntArray::
operator == ( const IntArray &rhs ) const
{
        if ( size() != rhs.size() ) {
                return ( FALSE ); 
        }
        int i = 0;
        while ( i < size() ){
                if ( self[i] != rhs[i] ){                      
                        return ( FALSE );
                }
                else i++
        }
        return ( TRUE );
}

thanks!!

charity

>else i++
Copy and paste can be a bitch. :D Add a semicolon to this line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.