For some reason i can’t seem to get this right
ok i have 2 objects
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;
}
This is your problem:
You should not declare a variable with the same name as its type. Make the types uppercase and everything should work OK for you. Also do not forget to move the definition of those two variables above the functions they are being used in.