DEV Community

Discussion on: The Four Pillars of Object Oriented Programming

Collapse
amaralani profile image
Amir Maralani • Edited on

First of all thanks for a good post!
But in your encapsulation example, I see this :

let cat1 = new Dog()
...
let cow1 = new Dog()
Enter fullscreen mode Exit fullscreen mode

It works but I suggest you either initialize them from the corresponding classes or change the variable names (dog2, dog3) to make the code clean.

Collapse
greedybrain profile image
Naya Willis Author

Sorry, my mistake.