php - PHP 2 class implements interface
问题描述
Why the code didn't display a solution to object Ab. If i want display for object Ab i must add $Ab->a().
<?php
interface AB {
public function a();
}
class A implements AB{
public function a() {
echo "aaaa";
}
}
class B implements AB {
public function a() {
echo "bbbb";
}
}
$Aa = new A;
$Ab = new B;
this code show only aaaa without bbbb. Why this work that? How to display both objects do nothing more?
解决方案
推荐阅读
- google-apps-script - Create Google Apps Script file with DriveApp
- java - 从给定的整数值,如何在java中打印前两位数,然后是后两位数
- python - 对于嵌套 JSON,explode() 在 python 中没有按预期工作
- angular - 在 Angular 中加载谷歌地图,不要在第一次加载
- powershell - 在 powershell 中显示来自两个对象的信息
- hyperledger-fabric - 在 v2.1 Hyperledger Fabric 网络中升级链码失败
- javascript - 如何使用 reactjs 的 package.json 脚本使文件可运行?
- azure-functions - ILogger 的所有条目都到哪里去了?
- python - Python:无法从更高的目录导入类
- aws-lambda - 如何将所需的输入从应用程序传递到 Amazon Lex Bot?