-
-
Save Danack/f2ae3f3b0b75c01d48fbfe44de47d4d4 to your computer and use it in GitHub Desktop.
asdasd
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
class A { | |
public function bar() : int {} | |
} | |
class B extends A { | |
public function bar() : void {} | |
} | |
function foo(A $bar) { | |
// prepare to be surprised when $bar is instance of B | |
$value = $bar->bar(); | |
} | |
if (rand(0, 1)){ | |
$object = new A(); | |
} | |
else { | |
$object = new B(); | |
} | |
foo($object); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment