Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
296 B
0
Indexable
Never
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;
    }
};
Leave a Comment