Java code:
public class Parent {
// implementation
public integer create(int val) {
// implementation
}
}
public class Child extends Parent {
// implementation
public integer create(int val) {
super.create(val);
// my further implementation
}
}
myObj = new Child();
myObj.create(val);
now i did this in php:
class Parent {
// implementation
function create($val) {
// implementation
}
}
class Child extends Parent {
// implementation
function create($val) {
$this->create($val);
// my further implementation
}
}
$myObj = new Child();
$myObj->create(val);
above, actually crashes the PHP (atleast on webserver). no respond page is displayed.
Any other workarounds using this methodology? anyone came across something like this? i know there are solutions, e.g. in child class have function myCreate() and then call $this->create(); within myCreate()...
but that would be something extra to remember for the users, and also could be misleading i.e. the different name.
is there any other way of calling Super method in PHP? i think this is solved in Zend2 with parent-> and self-> etc... or not?
regards,
Daarius...