about interface
Posted: Sat Feb 20, 2010 6:30 am
Hi
i have a question in OOP
what is the difference between these code
and what is the benefit when i'm using interface
and
each one work exactly same the other.
Thanks..
i have a question in OOP
what is the difference between these code
and what is the benefit when i'm using interface
Code: Select all
interface IUser
{
function getName();
}
class User implements IUser
{
public static function Load( $id )
{
return new User( $id );
return;
}
public function __constructs( $id )
{
return;
}
public function getName()
{
echo "Belal";
return;
}
}
$ob = User::Load( 1 );
$ob->getName();
Code: Select all
class User
{
public static function Load( $id )
{
return new User( $id );
return;
}
public function __constructs( $id )
{
return;
}
public function getName()
{
echo "Belal";
return;
}
}
$ob = User::Load( 1 );
$ob->getName();
Thanks..