mercredi 31 mai 2017

Function definition not being recognized by function body

I've created a class called Payload, and have a std::vector<Payload> in a class called LineShape. I've also created a function inside LineShape to get a Payload from the std::vector at a given index. This is Payload:

payload.h

class Payload {
public:

Payload (payload_type pType) {
    type = pType;
}

payload_type getPayloadType() {
    return type;
}

private:
    payload_type type;
};

and the function that is causing problems:

LineShape.h

    Payload getPayloadAt(int index) {
        return transfer.at(index);
    }

Visual Studio returns the following error:

C2334    unexpected token(s) preceding '{'; skipping apparent function body

Apparently, this means it isn't recognizing the body of the function, as a function, due to the definition of the function, but it seems okay?

Aucun commentaire:

Enregistrer un commentaire