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?
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) {}
intoperator()() { return m_a + m_b; }
};
int main()
{
Adder adder(3, 4);
int c = adder();
}