2

A级

class A {
    public foo( Apple $apple )
    {
      //whatever
    }
}

YetAnotherFile.php(在同一个项目中)

$a = new A;

$a->foo( 42 );  // I really would like a little warning flag here
$a->foo( new Apple(), 'howdy' );  // I really would like...
$a->bar();  // I really would like...

我希望我自己的例子是对的,无论如何我希望你明白我的意思。

谢谢...

4

0 回答 0