Method? How to abstract method?

I am writing some Finite Element Analysis code, I created some classes like the mesh, cell, element, etc. And then the finite element analysis is based on these entities. And I find the OOP didn't do much help to simplify or hierarchify my code. I am putting everything into mesh class as member functions.

I am wondering how can I wrap the method as class? Can we do that?
how can I wrap the method as class?
That sounds like a functor.

It's a class with some variant of an operaor()() method. For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Adder
{
    int m_a, m_b;

public:
    Adder(int a, int b) : m_a(a), m_b(b) {}

    int operator()() { return m_a + m_b; }
};

int main()
{
    Adder adder(3, 4);
    int c = adder();
}
Topic archived. No new replies allowed.