为什么我不能在接口中声明抽象方法?这是我的代码。谢谢你。
<?php
interface Connection {
public abstract function connect();
public function getConnection();
}
abstract class ConnectionAbstract implements Connection() {
private $connection;
public abstract function connect();
public function getConnection() {
return $this->connection;
}
}
class MySQLConnection extends ConnectionAbstract {
public function connect() {
echo 'connecting ...';
}
}
$c = new MySQLConnection();
?>