I am trying to add a method to a class by extending it and then to cast an object to my child extended class:
public class motherClass(){
public function methodA(){}
}
public class childClass extends motherClass (){
public function methodB(){}
}
$obj= Method that return an istance of motherClass
$objChild = (childClass) $obj;
$objChild->methodB();
Is possible to do this in PHP ? I need to instaziate the $objChild becouse I want to call some method from childClass in an object that belongs to motherClass.