dimanche 19 février 2017

Getting error "skipping apparent function body" with simple header file

The error seems to happen at the first if statement. I can't seem to understand why this would be happening. The if is not in the global namespace as my googling has lead me to check.

I do apologize if I'm not posting correctly but this is my first post.

Thanks in advance. This is probably stupid simple but I'm currently learning.

#ifndef moveHare
#define moveHare

//Create new class for Hare movement roll
class moveHare
{
//Initialize variables to be used
    int hareMovement = 0;
    int hareRoll = rand() % 100 + 1;

private:
//if statements to compare the random int to the movement int 
//Error happens at first if statement.`enter code here`
    if (hareRoll > 50) {
        hareMovement = hareMovement + 3;
    }

    else if (hareRoll > 50 && hareRoll < 71) {
        hareMovement = hareMovement + 6;
    }
};

#endif

Aucun commentaire:

Enregistrer un commentaire