在点函数上获得以下错误

时间:2011-12-06 20:09:12

标签: c++ abstract-class

您好我在尝试编译代码时遇到以下错误。  错误C2143:语法错误:缺少';'在'。'之前当我打电话

Points.addPoints(); 谢谢你的帮助。

#ifndef _POINTS_H
#define _POINTS_H
//points.h 

#include <sstream>

using namespace std;


class Points{

int pointsADD;
int pointsRemove;
int newPoints;

public :


    Points(int points){this->pointsADD=points;this->pointsRemove=pointsRemove;this->newPoints=newPoints;}



void addPoints(int newPointsADD){
        newPoints=pointsADD+newPointsADD++;
    }

void removePoints(int newPointsRemove){
    newPoints=pointsRemove+newPointsRemove--;

}

int getPoints(){
    return newPoints;
}

};

#endif

1 个答案:

答案 0 :(得分:3)

您需要该类的实例来添加任何内容。阅读一篇优秀的C ++简介,并立即修复:

Points p(42);
p.addPoints(23);