[ create a new paste ] login | about

Link: http://codepad.org/FphVRZ3S    [ raw code | output | fork ]

epper - PHP, pasted on Jan 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

interface Eatable {
   public function eat();
}

class A implements Eatable {
  public function eat() {return 1;}
}

function foo(Eatable $obj) {
  return $obj->eat();
}

foo(null);  // FAIL

?>


Output:
1
2

Catchable fatal error: Argument 1 passed to foo() must implement interface Eatable, null given, called in /t.php on line 15 and defined on line 11


Create a new paste based on this one


Comments: