Open utterances-bot opened 3 years ago
Hi Tania,
Very nice explanation!
Remark: In php you have: parent::construct($name, $level, $weapon); shouldn't that be? parent::construct($name, $level); since $weapon does not exist in the parent?
Fun, Why don't you make it: return "{$this->name} attacks with the {$this->weapon} at level {$this->level}";
Greetz :-)
Gosling
Object Oriented Pattern: JavaScript Classes and PHP Classes | Tania Rascia
I wrote an article on Understanding Prototypes and Inheritance in JavaScript for DigitalOcean, in which I explained how to use constructor…
https://www.taniarascia.com/object-oriented-pattern-javascript-php-classes/