pond2539 发表于 2017-3-21 12:43:08

java php 之instanceof

  java: instanceof 

if(ainstanceof b){
return true;
}
如果 a对象可以成功转换成b 则返回true;

  java中主要是判断对象转换
  php:

interface Ipeed(){
function getMaxSpeed();
}
class car implments Ipeed{
if($car instanceof Ipeed){
return true;
}
}
  php中主要判断 对象$car是否成功的继承了Ipeed.
页: [1]
查看完整版本: java php 之instanceof