How can you define a function of a class to be recursive?, this is what I have been doing:
class A
{
private:
public:
_recursive(A *var);
recursive()
}
A::recursive()
{
_recursive(this)
}
A::_recursive(A *var)
{
_recursive(var->next);
}
And on main:
A *temp = new A();
A->recursive();
I have also tried (same class as before)
A *temp = new A();
A->_recursive(&A);
There seems like this should be something somebody else has found and easier or more elegant way of doing so, I tried making the class simple just to demonstrate, but this is a single linked list transverse program so it needs recursion.