No match for Operator

Hi im getting an error: 53|error: no match for 'operator==' in 'cells[i].Battleships::Cell::processAttack() == (Battleships::Cell::State)2u'|

The error comes from this line:
assert ( cells[i].processAttack () == Battleships::Cell::Miss );

The decleration of class is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace Battleships{
class Cell
{
    friend std::ostream &operator << (std::ostream &out, const Cell &cell);
    friend std::istream &operator >> (std::istream &in, Cell &cell);
public:
    enum State {Unknown, Hit, Miss};
private:
    State state;
    Battleships::Ship *Ship;
public:
    Cell():state(Unknown), Ship(NULL){};
    void processAttack();
    State getState() const;
    void setShip(Battleships::Ship* point);
};
}

and the processAttack is:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
State Battleships::Cell::processAttack()
{
    if(Battleships::Cell::state!=NULL)
    {
        if(Battleships::Cell::Ship==NULL)
        {
            state=Miss;
            return Miss;
        }
        else
        {
            Battleships::Ship.addHit();
            state=Hit;
            return Hit;
        }
    }
    else {throw std::out_of_range ("Cell has already been attacked");}

}


Any help would be awesome
Last edited on
The declaration of function void processAttack(); does not correspond to its definition State Battleships::Cell::processAttack()
Thanks :) always something stupid like that :(
Topic archived. No new replies allowed.