Skip to content

Instantly share code, notes, and snippets.

@andrusha
Created June 30, 2011 04:40
Show Gist options
  • Select an option

  • Save andrusha/1055648 to your computer and use it in GitHub Desktop.

Select an option

Save andrusha/1055648 to your computer and use it in GitHub Desktop.
Inheritance example for habrahabr
<?php
class A {
public function setSize($x, $y) {
print('A');
}
}
class B extends A {
public function setSize($x) {
print('B');
}
}
$a = new A();
$a->setSize(1, 2);
$b = new B();
$b->setSize(1);
$b->setSize(1, 2);
@andrusha
Copy link
Copy Markdown
Author

Output:
ABB

Because php allows you to pass to functions any number of arguments

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