Skip to content

Instantly share code, notes, and snippets.

@yuya-matsushima
Created April 23, 2013 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuya-matsushima/5440252 to your computer and use it in GitHub Desktop.
Save yuya-matsushima/5440252 to your computer and use it in GitHub Desktop.
<?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