PDA

View Full Version : About the Flags



rezas1000
17th August 2014, 17:25
Hello
I know the concept of enum But I do not know the meaning of Flags.
Please explain about Flags.
thanks.

anda_skoa
17th August 2014, 17:38
A flag is basically an enum value that is a single power of 2, e.g. 1, 2, 4, 8, 16
Flags are then a bit-wise OR combination of such flag values, e.g. 3 being "1 or 2".

So flags are a single numerical/integer value that is composed of binary distinguishable values.

Used when a single variable or function argument needs to transport a combination of conceptionally boolean values.

Cheers,
_