在点函数上出现以下错误
您好,当我尝试编译代码时出现以下错误。 错误 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
Hi I am getting the following error when i am trying to compile my code.
error C2143: syntax error : missing ';' before '.' when i call
Points.addPoints();
Thanks for any help.
#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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要类的实例才能添加任何内容。阅读一篇很好的 C++ 介绍,并立即修复:
You need an instance of the class to add anything. Read a good C++ introduction, and fix for now: