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.

Front-ending a recursive algorithm that, by its normative nature uses a parameterized gating is what I think you’re

actuallytrying to ask about. For a linked list, for example, given this procedural typical recursive solution where the descent is parameterized and the base-case is exit-on-null:You can do the same thing with a member function by throwing that base logic in as a condition of the recursion. For example:

The same modus-operandi can be extended to more complex structures like a BST node:

At least I

thinkthat’s what you’re asking about.