how print multiple methods function in oops php
$a=new HTMLImage();
$newObject=new WebsiteLogo($a);
echo $newObject->getSource()->FunctionName()->getName();
______________________________________________________
class test
{
function __construct( )
{
# code...
}
public function getName()
{
echo "hello dear! my name is saddam hussain saifi";
}
}
/**
*
*/
class redme
{
function __construct( )
{
# code...
}
public function FunctionName()
{
# code...
return new test;
}
}
class HTMLImage
{
function __construct()
{
}
public function getSource()
{
return new redme();
}
}
class WebsiteLogo
{
private $img;
public function __construct( HTMLImage $a)
{
$this->img =$a;
}
public function getSource()
{
return $this->img->getSource();
}
}
$a=new HTMLImage();
$newObject=new WebsiteLogo($a);
echo $newObject->getSource()->FunctionName()->getName();
OUTPUT :-
hello dear! my name is saddam hussain saifi
$a=new HTMLImage();
$newObject=new WebsiteLogo($a);
echo $newObject->getSource()->FunctionName()->getName();
______________________________________________________
class test
{
function __construct( )
{
# code...
}
public function getName()
{
echo "hello dear! my name is saddam hussain saifi";
}
}
/**
*
*/
class redme
{
function __construct( )
{
# code...
}
public function FunctionName()
{
# code...
return new test;
}
}
class HTMLImage
{
function __construct()
{
}
public function getSource()
{
return new redme();
}
}
class WebsiteLogo
{
private $img;
public function __construct( HTMLImage $a)
{
$this->img =$a;
}
public function getSource()
{
return $this->img->getSource();
}
}
$a=new HTMLImage();
$newObject=new WebsiteLogo($a);
echo $newObject->getSource()->FunctionName()->getName();
OUTPUT :-
hello dear! my name is saddam hussain saifi
Comments
Post a Comment