Results of 1 - 2 of about 2 for speak (0.001 sec.)
- 共変性と反変性 | PHP 8.3 11228
- 共変性と反変性 PHP 7.2.0 で、子クラスのメソッドのパラメータの型の制限を除く形で、反変性が一部サポートされました。 PHP 7.4.0 以降で、共変性と反変性が完全にサポートされるようになりました。 共変性とは、子クラスのメソッドが、親クラスの戻り値より
... protected string $name ; public function __construct ( string $name ) { $this -> name = $name ; } abstract public function speak (); } class Dog extends Animal { public function speak () { echo $this -> name . " barks" ; } } class Cat extends Animal { ... public function speak () { echo $this -> name . " meows" ; } } この例では、どのメソッドも値を返さないことに注意して下さい。 以下ではこれらのクラ ... 代わりに、Dog 型を返すことができる { return new Dog ( $name ); } } $kitty = (new CatShelter )-> adopt ( "Ricky" ); $kitty -> speak (); echo "\n" ; $doggy = (new DogShelter )-> adopt ( "Mavrick" ); $doggy -> speak (); 上の例の出力は以下となります。 Ricky ...
-
https://man.mtool.work/php/8.3/language.oop5.variance.html
- The Yar Protocol | PHP 8.3 7485
- The Yar Protocol Yar does not rely on a schema or IDL file: everything is exchanged on the wire as plain bytes. Any language that can read and write bytes can speak to a Yar service, without installing any framework at all — build one fixed
...
-
https://man.mtool.work/php/8.3/yar.protocol.html
PREV
1
NEXT