Skip to content

Instantly share code, notes, and snippets.

@bimaktuel
Created April 14, 2013 14:33
Show Gist options
  • Save bimaktuel/5382953 to your computer and use it in GitHub Desktop.
Save bimaktuel/5382953 to your computer and use it in GitHub Desktop.
<?php
abstract class Shape
{
public function isShape()
{
return true;
}
}
class Square extends Shape
{
public function isSquare()
{
return true;
}
}
class Circle extends Shape
{
public function isSquare()
{
return false;
}
}
class Person
{
public function isSquare()
{
return false;
}
}
function checkSquare (Shape $sh) {
echo ($sh->isSquare()) ? "Yep" : "No";
}
checkSquare(new Square); // <- echoes "Yep"
//checkSquare(new Circle); // <- echoes "No"
//checkSquare(new Person); // <- type error
12 nisan cuma <a title="bim aktüel" href="http://cumabimaktuelurunler.blogspot.com/">bim aktüel</a> ürünler
yayınalndı.
ayrıca <a title="19 nisan bim aktüel" href="http://cumabimaktuelurunler.blogspot.com/">19 nisan bim aktüel</a>
@bimaktuel
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment