The class Flags is already defined with a private variable bits, a constructor, and a getter.
Your task is to define the ~ operator so that applying ~flags creates a new Flags object with all bits inverted.
In main() we are:
main()
Flags
~
Print the toggled result in the format:
Input=<Input value> Toggled Input=<toggled value>
Example Input:
0
Output:
Input=0 Toggled Input=255
Input:
255
Input=255 Toggled Input=0
170
Input=170 Toggled Input=85
Test Cases
Test Results
Input
Expected Output