如果不使用包装类,我可以在PHP中加载多个(非分层)子类吗?

Right now I have a class that gathers and holds information about a specific program that runs in multiple instances on my machine streaming a few radio stations.

What I waned to do was have separate children classes that have different aspects of what I'd want to do. For example

  • Child Class 1, allow sending commands to the running instance
  • Child Class 2, query the program for pulling meta data and playlist history

Now most scripts only would do one of those things, with the except of a few which I'd want to have access to BOTH of the children classes.

Is there any way without having Child 1 extend Child 2 which extends the Parent, to have an instance which includes both children, or is hierarchical the only option in PHP for doing this?

I think you can move this logic to traits (http://php.net/manual/en/language.oop5.traits.php) and just include them in required classes. Make sense?