error C2440: '=' : cannot convert from 'bool' to 'bool *'

Posted by William on Stack Overflow See other posts from Stack Overflow or by William
Published on 2010-05-30T15:46:13Z Indexed on 2010/05/30 15:52 UTC
Read the original article Hit count: 474

Filed under:
|
|
|

I'm getting said error on this line "b = true". Now Why am I getting this error? Aren't I pointing to TurnMeOn and thus saying TurnMeOn = true?

class B{
void turnOn(bool *b){b = true}
};

int main(){
B *b = new B();
bool turnMeOn = false;
b->turnOn(&turnMeOn);
cout << "b = " << turnMeOn << endl;
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about class