B
B
Barney_Gubmle2018-10-21 01:12:59
PHP
Barney_Gubmle, 2018-10-21 01:12:59

How to get "into the depths" of an object?

Hi, next question.
There is an object A
There is B that inherits A
, A has a $var variable
and has an add() method
(which, logically, B also has)
When adding() is called, the B object must be written to the very end of the chain in the $var variable I
explain on my fingers: call add () Press again I beg you: 1. do not throw slippers, but I'm a noob 2. Do not spoil the answer. but push towards a solution. I've tried different iteration methods. I can climb into the depths, but I don’t know how to “climb out” or something else Thank you!
А([var]=>)
A([var]=>B([var]=>))
A([var]=>B([var]=>B([var]=>)))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
profesor08, 2018-10-21
@profesor08

Well, $var is an array, so work with it like an array. All elements match the order in which add is called.

A
Artyom, 2018-10-21
@dark1112

Looks like what you need
php.net/manual/kr/keyword.parent.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question