Trouble in my class

Started by
11 comments, last by Servant of the Lord 17 years, 10 months ago
Quote:Original post by Scet
Quote:
else if(On_off = 1)


Shouldn't that be "On_off == 1"?

I always do that! It takes me awhile to figure out when I miss a eqaul. Thanks for spotting that.

That still isn't the problem though...
Advertisement
If you were to put the constant on the left side of the equality test, then the compiler would let you know when you omit that second =.

Like so:

else if (1 == On_off) // valid

whereas:

else if (1 = On_off) // compiler will complain that you can't assign value to a constant
!!!

IT COMPILED!

The problem was a mixture of me putting the function in a header, as deathkrush and Trillian showed me, and some error in Dev C++ itself where it still thinks I want Pull(std::string OnSound, std::string OffSound); even after I replaced that function and hit 'Rebuiled all' a few times.

So I changed Switch::Pull() to Switch::pull() and it now works!

Many thanks for everyone's help, and closing Dev C++ and reopening it should clear the bug.

This topic is closed to new replies.

Advertisement