Lab Test - 02 (CSE-16th)
Lab Test - 02 (CSE-16th)
a) Define a class named Counter with a private attribute value (int) to store the counter value.
b) Implement a default constructor for the Counter class that initializes the counter value to 0.
c) Overload the unary operators ++ (prefix and postfix) and -- (prefix and postfix) to perform increment
and decrement operations on the counter value.
d) Define member functions display() to display the current counter value.
e) Develop a main() function to demonstrate the functionality of the Counter class:
a. Create a Counter object.
b. Increment and decrement the counter using both prefix and postfix operators.
c. Display the counter value after each operation.