Monday, 6 January 2014

Prototype Language

Most of us are thinking that JavaScript is object oriented programming language.Actually it is not. we will get confuse when we say Java is object oriented programming language and JavaScript is prototype based language. lets see the difference between them.

In Object Oriented Programming language everything will be represented as classes and Instances. Prototype based language is in which behaviour reuse (known as inheritance) is performed via a process of cloning existing objects that serve as prototypes.

For example "Fruit" is an object. It represents the properties and general functionalities of fruit. Another object "Strawberry" would be cloned from "fruit" object  and would also be extended to include general properties specific to bananas.
In prototype-based languages there are no explicit classes and objects inherit directly from other objects with which they are linked through a property, often called prototype as in the case of Javascript.

No comments:

Post a Comment