Answer the question
In order to leave comments, you need to log in
PHP, to inherit an object during execution, is it possible?
Situation: you must first declare class A, then include a number of files in which library class B is declared (part of the paths is calculated in class A), then make sure that during execution it turns out A extends B. If I immediately write extends B, then an error will fly out, t .to. required files not found.
I understand that the question is strange and is actually the result of an incorrect architecture, but for a number of reasons in the old application I cannot use autoload and composer in this place. Instead of inheritance, I used the use of a class as an object variable, but with inheritance it would have turned out more beautiful and without unnecessary wrappers. The question is more of an academic interest in the non-standard features of the language. Is there a way to dynamically assign a parent to an object?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question