Possible Duplicate:
How do I call PHP parent methods from within an inherited method?
I am trying to override a function in php in the following way
main class
<?php
class Curl{
/* constructor */
public function Curl(){}
/* login */
public function login($url, $post_fields){
...
}
}
?>
sub-class
<?php
require_once("/var/www/api/curl/curl.php");
class Curl_B extends Curl{
/* constructor */
public function Curl_B(){}
/* login */
public function login(){
$this->login(
'https://xxx.co.uk/login.php',
'email=xxx&pass=xxx'
);
}
}
$curl = new Curl_B();
$curl->login();
?>
The issue is that I cannot seem to call the parent function login() properly if the sub-class has a function with the same name.
I understand that you can not have functions which share the same name so what is the best best solution to my problem?
To call the parent class’s function by the same name: