return object from parent class function to children class function
well... after so long days i am in big problem.. i did research in this
before posting here..
here it is..
<?php
class a
{
public function loadFile($file)
{
include $file . ".php";
$f = new $file();
//$f -> get(); i can access this
return $f;
}
}
class b extends a
{
public function getData()
{
$abc = $this -> loadFile("abc");
$abc -> get();//object is not returning here.. so not able to
access this function
}
}
?>
i have no idea whats wrong with this? do i am violating some oops rule? if
it so, how can i get this done in similar way.
No comments:
Post a Comment