Dear colleagues, in these few lines I will make my contribution to our blog. Sorry for the tardiness, and I hope they serve something.
for days experiencing a bit of a script based language (javascript), try implementing the OOP paradigm, following the general rules by creating classes with their properties and methods.
class Person {
/ / attributes
public Person () {}
/ / methods public
method1 () {}
} Surprise
javascript is a object-oriented language but uses a special style of this paradigm, and by that I mean the prototypes, that if you refer to the same ideas of OOP, such as code reuse, inheritance, polymorphism, encapsulation, hiding among others.
Programming based prototypes is a style of object-oriented programming in which "classes" are not present, and re-use of processes (known as inheritance in class-based languages) is obtained through cloning existing objects that serve as prototypes, extending its functionality. This model is known as prototypes oriented or instance-based programming .
http://en.wikipedia.org/wiki/Prototype-based_programming .
This topic of interest try to explain this in code.
The following case wanted to get the next number multiple of 6 earlier of a number X.
create our archive lies the POO.
clases.js
html file
An example simple and easy to make I give you some link for if they want to implement some other stronger features such as inheritance and polymorphism.
Greetings to all and take care.
a good
PDF
0 comments:
Post a Comment