Java Reference
In-Depth Information
Classes
Many object-oriented languages, such as Java and Ruby, are known as classical languages .
This is because they use the concept of classes to define a blueprint for an object. Objects
are then created as an instance of that class and inherit all the properties and methods of
the class. In my juicer example, the juicer class would represent the design of the juicer,
and each juicer that's made on the production line would be instances of that class.
JavaScript doesn't use classes (although ECMAScript 6 will support them), but it does use
the concept of object prototypes, which can be used as a blueprint for creating other ob-
jects. JavaScript is said to have a prototypal inheritance model. In the juicer example, this
might involve building an actual prototype juicer and then using this prototype as the basis
for making all the other juicers. The juicers based on the prototype would be able to do
everything the prototype could do, with some being able to do even more.
Search WWH ::




Custom Search