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:
Toggled=<value>
Example Input:
0
Output:
Toggled=255
Input:
255
Toggled=0
170
Toggled=85
Test Cases
Test Results
Input
Expected Output