开发者

Member function declared, but compiler says its not

开发者 https://www.devze.com 2023-04-10 13:09 出处:网络
This is my Position.h file: #ifndef POSITION_H_ #define POSITION_H_ class Position{ public: Position(int v);

This is my Position.h file:

#ifndef POSITION_H_
#define POSITION_H_

class Position{
    public:
    Position(int v);
    int pos();
    private:
    int value;
    bool win;

};

#endif

This is my Position.cpp file:

#include "Position.h"

Position::Position(int v):value(v){
}

int Position::pos(){
    return value;
}

My error is:

Position.cpp:8: error: no 'int Position::pos()' member function declared in class 'Position'

I've been trying to fix this for hours and the function is declared. I don't 开发者_JS百科understand why this wont compile.


Its compiling for me... you must be doing something weird.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号