Untitled

 avatar
unknown
plain_text
a year ago
296 B
3
Indexable
class Count {
private:
    int value;

public:
    // Constructor to initialize count to 5
    Count() : value(5) {}

    // Overload ++ when used as prefix
    void operator++() {
        ++value;
    }

    void display() {
        cout << "Count: " << value << endl;
    }
};
Editor is loading...
Leave a Comment