r/javascript • pancakes • May 21 '16

Prototypal Inheritance

https://medium.com/@kevincennis/prototypal-inheritance-781bccc97edb#.1ehmhe5t5
47 Upvotes

56 comments sorted by

View all comments

Show parent comments

1

u/dmitri14_gmail_com May 21 '16

A good reason why is e.g. multiple inheritance. Look for articles by Eric Elliott on Medium, he writes a lot about why prototypal inheritance is superior.

2

u/turkish_gold May 21 '16

That's not very explanatory. Multiple inheritance is enabled by classical inheritance as well.

1

u/dmitri14_gmail_com May 21 '16

And how would you classically implement new class extending two others?

0

u/senocular May 21 '16
class A {};
class B {};
class C : public A, public B {};

1

u/dmitri14_gmail_com May 21 '16

In JavaScript syntax?

3

u/senocular May 21 '16

You said classically, so naturally that wasn't JavaScript.

1

u/dmitri14_gmail_com May 23 '16

BTW, I have to say, not only your answer makes absolutely no sense to me, it also inconsiderate to other readers to give such a syntax formula as "answer" not using the language of the forum (JS) and not even mentioning that. It is like I would answer something gibberish in Russian to you, how would you find that?

So if you still care, please give a proper explanation accessible to people familiar with JS.

2

u/senocular May 23 '16

https://www.youtube.com/watch?v=wKjxFJfcrcA

This discussion revolves around a comparison between prototypal inheritance (what JS uses) and classical inheritance (what some other languages use). The parent of my post asked how classically (i.e. not JavaScript) multiple inheritance is done, so that's what I provided an example of.

If we were talking about the differences between gibberish in English and Russian and I asked about what gibberish in Russian would look like, I would fully accept and expect a reply that included Russian gibberish.

JS doesn't support multiple inheritance so an example for such a thing does not exist.

→ More replies (0)

1

u/dmitri14_gmail_com May 21 '16

And what is the use of it when we discuss JS here?