编写类时接口的用途是什么?
这是我在网上看到的一个例子。
<?php
interface Chargeable {
public function getPrice();
}
class Employee implements Chargeable {
protected $price;
public function getPrice() {
return $this->price;
}
}
$product = new Employee();
?>
https://stackoverflow.com/questions/601034
复制相似问题