function overloading


/*Those who is from CSE background may know in C++ we got some knowledge about function overloading … that is two or more function of the same name in the same class at a time … they only differ by their parameter number or type ..
In object oriented php we do not have to such thing .. cause we can use facilities of function overloading using some other way .. Below example give you a sample that utilize the same thing like function overlaoding ..*/
class hacker
public $hacker_name;
public $hacker_age;

public function set($hn)
$this->hacker_name = $hn;
$this->hacker_age = $hn;
public function get()
echo “Name: “.$this->hacker_name;
echo “Age: “.$this->hacker_age;


$hacker1 = new hacker();
echo “<br/>”;
$hacker2 = new hacker();


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s