Advertisement
Guest User

Overirde

a guest
Apr 15th, 2013
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class first {
  4.     public function something($param1) {
  5.         return 'first-'.$param1;
  6.     }
  7. }
  8.  
  9. class second extends first {
  10.     public function something($param1, $param2) {
  11.         return 'second params=('.$param1.','.$param2.')';
  12.     }
  13. }
  14.  
  15. // Strict standards: Declaration of second::something() should be compatible with that of first::something() in /home/szymon/webs/wildcard/www/source/public/override.php on line 13
  16.  
  17. $myClass = new Second();
  18. var_dump( $myClass->something(123,456) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement