How to call operator bool() explicitly from my object ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to call operator bool() explicitly from my object ?

I want to call operator bool() explicitly from my object The code is pasted below. https://code.sololearn.com/c68xH3k0z6SY/?ref=app

21st May 2020, 8:37 AM
Terminal_Phantom
Terminal_Phantom - avatar
1 Antwort
0
static_cast<bool>( a ); or the C style (bool)a You can also mark operator bool as explicit to force this.
21st May 2020, 8:53 AM
Dennis
Dennis - avatar