Created
April 23, 2013 02:02
-
-
Save yuya-matsushima/5440252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface iBase { | |
public function getData(); | |
} | |
class SampleA implements iBase { | |
public function getData() { | |
return 'A'; | |
} | |
} | |
class SampleB implements iBase { | |
public function getData() { | |
return 'B'; | |
} | |
} | |
function echoObj(iBase $obj) { | |
echo $obj->getData(); | |
} | |
echoObj(new SampleA()); | |
echoObj(new SampleB()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment