class A{
protected $Num1;
protected $Num2;
public $result;
public function getNum1(){
return $this->Num1;
}
public function setNum1($Num1){
return $this->Num1=$Num1;
}
public function getNum2(){
return $this->Num2;
}
public function setNum2($Num2){
return $this->Num2 = $Num2;
}
public function get_result(){
return null;
}
}
class Add extends A
{
public function get_result()
{
return $this->Num1+$this->Num2;
}
}
class Faction{
public function getR($re){
if($re=="+") {
$com = new Add();
return $com;
}
}
}
$model = new Faction();
$m = $model->getR("+");
$m->setNum1(1);
$m->setNum2(27777);
print_r($m->get_result());exit;