inheritance - How to check object instance is inherited from Abstract Class in PHP -


i have below abstract class

abstract class abstractperson{   ...... } 

i have inherited abstractperson account

class account extends abstractperson{   ...... } 

now going make object of class

$account= new account() 

i wondering how check $account object extended abstractperson class?

well, need reflection, , 2 methods getparentclass() & isabstract().

here's working example of need.

$accountreflection     = new reflectionclass('account'); $parentreflection     = new reflectionclass($accountreflection->getparentclass()->getname()); $isabstract           = $parentreflection->isabstract(); // return true of false 

Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -