I wasn't sure why both methods calls in the function Object() { [native code] } worked at first, but I think I now understand. Since the methods are passed down from the parent class and are also present in the extending classes, both should function.
Now I'm wondering whether there is a preferred technique (i.e. best practice) of calling the method (through a parent or this), whether these are actually identical ways of running the same code, or if there are any restrictions when using one over the other.
abstract class Animal {
function get_species() {
echo "test";
}
}
class Dog extends Animal {
function __construct(){
$this->get_species();
parent::get_species();
}
}
$spike = new Dog;
Can someone please help me with this?