I have an object that contains a reference to another object of the same type. Example in PHP:
class A {
protected $child;
public function __construct(A $child = null) {
$this->child = $child;
}
public function go() {
if($this->child) {
$this->child->go();
}
}
}
$a = new A(new A());
$a->go();
Is the go
method considered a recursive method? I can see it both ways myself, and I'm not sure if there is a 'correct' answer or not, but I assume that there is.