Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ParentClass {
- /**
- * Says 'hi' to the world.
- * @return ParentClass Returns itself for chaining.
- */
- public function say_hi(){
- echo 'hi';
- return $this;
- }
- }
- class ChildClass extends ParentClass {
- /**
- * Says 'bye' to the world.
- * @return ChildClass Returns itself for chaining.
- */
- public function say_bye(){
- echo 'bye';
- return $this;
- }
- }
- $c = new ChildClass;
- $c->say_hi()->say_b| <- type hinting won't suggest "say_bye" here
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement