在main.php
中,添加了自动加载并创建了一个新对象:
function __autoload($class) {
require_once($class . '.php');
}
...
$t = new Triangle($side1, $side2, $side3);
在Triangle.php
:
class Triangle extends Shape {...}
Shape.php
是一个抽象类:
abstract class Shape {
abstract protected function get_area();
abstract protected function get_perimeter();
}
我可以看到该__autoload
函数调用Triangle.php
,但它是否同时调用Shape.php
?