Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 PHP 魔术方法在 PHP 中实现多级继承?
我在一次采访中被问到“你将如何使用魔法方法实现多级继承”。
所以我很想知道这件事。
谢谢。
目前尚不清楚您的意思是“如何使用多级继承?” 或“它是如何在 PHP 解释器中实现的?”。如果是前者,那么如下:
class Animal { ... } class Cat extends Animal { ... } class Tiger extends Cat { ... }
如果是后者,那我不确定这里几段能不能给出合理的解释!