Files
CSCI-1200/lectures/21_hash_tables_II/functor.cpp
2023-11-14 13:49:55 -05:00

18 lines
331 B
C++

#include <iostream>
class MyFunctor {
public:
int operator()(int x, int y) {
return x + y;
}
};
int main() {
MyFunctor myFunc;
int result = myFunc(3, 4); // This calls the overloaded () operator.
// result now holds the value 7.
std::cout << "result is " << result << std::endl;
return 0;
}