【发布时间】:2010-09-27 21:00:00
【问题描述】:
由于某种原因,我似乎无法做到这一点 好的,我有 2 个对象
class score
{
public:
int scored(int amount);
private:
int currentscore;
}
int score::scored(int amount)
{
currentscore += amount;
return 0;
}
class collisions
{
public:
int lasers();
}
// ok heres my issue
int collisions::lasers()
{
// some code here for detection
// I need to somehow call score.scored(100);
score.scored(100); // not working
score::scored(100); // not working
// how do i do that?
}
collisions collisions;
score score;
int main()
{
while (true)
{
// main loop code here..
}
return 0;
}
【问题讨论】:
-
将对象实例命名为与类名相同的东西只能以泪水结尾。
-
两年后回看这篇文章,我不敢相信我的编码技术有多糟糕。