Php policy mode problems ~~~ Expert guidance ~~ Thank you for helping me change the code below. I made the interface for learning martial arts and using weapons, and made the behavior into a class. but how to use it is messy. Subscribe to PHPcode & lt ;? Phpjavasactclassperson {question about the abstractpublicfunctionspeak php policy mode ~~~ Expert guidance ~~ Thank you for helping me change the following code.
I made martial arts and weapons into an interface and behavior into a class, but how to use them is messy. Score immediately
PHP code
Studywx (studtq); $ chperson-> usewq (xiaoqiang); $ chperson-> studywx (studtq); $ amperson = new amperson (); $ amperson-> studywx (studyw ); $ amperson-> usewq (xiaoqiang); $ amperson-> studywx (qiang);?>
------ Solution --------------------
It simplifies your example a little. it should be much clearer to see the annotations.
PHP code
Studywx ();} public function usewq ($ wq) {$ wq-> usewq () ;}} class chperson extends person {public function speak () {echo "Chinese are talking, different routes! ~ ";}} Class amperson extends person {public function speak () {echo" the Americans are talking about it !~ ";}} Interface istudy {public function studywx ();} class studyw implements istudy {public function studywx () {echo" ";}} class studtq implements istudy {public function studywx () {echo "sunflower collection" ;}} interface iwq {public function usewq ();} class jian implements iwq {public function usewq () {echo "" ;}} class qiang implements iwq {public function usewq () {echo "foreign gun" ;}}$ chiness = new chperson (); // add a Chinese guy $ chiness-> studywx (new studyw (); // learn $ chiness-> usewq (new jian ()); // give him the $ american = new amperson (); // bring up an american $ american-> studywx (new studtq ()); // $ american-> usewq (new qiang (); // give him a broken foreign gun