How to call operator bool() explicitly from my object ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answer
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