php overridefunction,PHP 7.2中abstract function override的用法

PHP 7.2中abstract function override的用法

发布时间:2020-06-19 13:30:19

来源:亿速云

阅读:107

作者:鸽子

关于 PHP 7.2 abstract function override 的使用abstract class KeyManagerAbstract

{

/**

* 类似于

*

* return [

* self::UCC_USER_DETAIL => ["ucc:user:h:%d", 10],

* ];

*

* @return array

*/

abstract protected static function hashMap();

public static function getHashKey(string $format, int $id)

{

}

}

class KeyManager extends KeyManagerAbstract

{

protected static function hashMap()

{

// TODO: Implement hashMap() method.

}

}

php 7.2 之前这样写是会报错Fatal error: Can't inherit abstract function

php 7.2 则支持了abstract function override

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值