Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rutuja027 authored Oct 10, 2019
1 parent 6626c40 commit 557db31
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Chapter05/Examples/MyClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
class A
{
public function say()
{
echo 'Base ';
}
}
trait T
{
public function say()
{
parent::say();
echo 'Trait ';
}
}
class MyClass extends A
{
use T;
public function say()
{
echo 'Overridden! ';
}
}
$object = new MyClass();
$object->say(); //outputs, Overridden!

0 comments on commit 557db31

Please sign in to comment.