taniarascia / comments

Comments
7 stars 0 forks source link

object-oriented-pattern-javascript-php-classes/ #92

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

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/

goslingcools commented 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