📜  c++代码示例中的函子

📅  最后修改于: 2022-03-11 14:44:51.551000             🧑  作者: Mango

代码示例4
class MultiplyBy {
private:
    int factor;

public:
    MultiplyBy(int x) : factor(x) {
    }

    int operator () (int other) const {
        return factor * other;
    }
};