Классы / Методы

#include <iostream>
using namespace std;

class Counter {
public:
    int count;

    void incBy(int value) {
        count += value;
    }

    void incBy(int value, int amount) {
        count += value * amount;
    }
};

Counter *counter = new Counter;
counter->incBy(1);
//counter.count is 1

counter->incBy(25);
//counter.count is 11

cout << "count is " << counter->count;

delete counter;