I came across some code I don't understand. In a class B there is a pointer to a method of a different class A but the pointer has no variable. How can I call this method in class B? This is part of a larger project of someone else, i would like to preserve the existing code.
class A {
public:
A *root() { return this; }
};
class B {
public:
A *root();
};
I expected something like this
A *myA = root();
inside class B to work but i get linker error "undefined reference to ...". The question is more how this construction is called, what is it useful for and how to use it.