When it comes to inheritance, JavaScript only has one construct: objects. Each object has a private property which holds a link to another object called its prototype. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype.
JavaScript is a class-free, object-oriented language, and as such, it uses prototypal inheritance instead of classical inheritance.
Classes. The most important difference between class- and prototype-based inheritance is that a class defines a type which can be instantiated at runtime, whereas a prototype is itself an object instance.
Both classical and prototypal inheritance are object-oriented programming paradigms. Objects in object-oriented programming are abstractions that encapsulate the properties of an entity.
I was reading about prototype-based languages and this doubt comes into my mind:
Is .NET Object Creation ex nihilo ("from nothing") and so allow new objects to be created from scratch? Or, instead, is .NET object creation based on cloning from an existing object (i.e. Object) as the cloning prototype for new object creations?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With