16 lines
606 B
HTML
16 lines
606 B
HTML
<p>
|
|
Sometimes you need to store lots of diffrent state about a type.
|
|
Usualy that it has something or not. It would be wastefull to
|
|
use for each feature a single value. The more effitient way is
|
|
to store it using flags.
|
|
</p>
|
|
<p>
|
|
To do that, you can use enums. You just have to assigne the values, such that
|
|
only one bit is ever set and no member shares a bit.
|
|
You can then set multiple flags by or-ing them together using |-operator.
|
|
To check, if a flag is set, use the &-operator.
|
|
</p>
|
|
<p>
|
|
Implement a <it>Set</it> and <it>isSet</it> function to make these operations more readable.
|
|
</p>
|