Interface Example

<?php

/*If many class in a application needed to to be able to to send e-mail messages it would be desirable if they all did the job with methods of the same name and had the same number and type of arguments*/

interface hack
{
public function com();

}
class hi_amigos implements hack // for the time to attach more interface just seperate each interface with single comma .. that is ” class hi_amios implements hack, dice ”

{
function __construct()
{
echo “amigos created<br/>”;
$this->com(); // here you must call the function that we made in interface else we will not get any output from the com() function …
}
public function com()
{
echo “Here would be the definition”;
}
}
$object = new hi_amigos();

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s