We’ve already talk here in our blog about objects and attributes and how they work. Now we’re going to talk about another item that makes part of the oriented programming to objects, the methods.

As the attribute represents the objects characteristics, the methods are like actions that the object can generate. This actions will depend on the type of object and they are responsible to the information processing inside a object.

For example: a car can walk and brake. If we analyze from the programming point of view, both actions can be transformed into methods that will control the speed variable. Check this code bellow:

Var car = new Car();

car.Accelerate(60);

car.Break();

On the code above, notice that the object initiates his activities with the Accelerate() that is receiving the value 60, that been the maximum value that the variable inside the object can get. In a second moment, the method Break( ) is called, so the Speed variable will have his value rebooted.

02.01

With the use of methods, is possible to make available to the programmer only the manipulation interface, without worry him with rules or validations. All this is can be managed by the class implementation (object).

You might also like…

PROCESAMIENTO AJAX EN SCRIPTCASE

Ajax en los formularios de Scriptcase puede usarse para recargar un campo de tipo de select basado e...

IMPORTAR IMAGENES DE LA BASE DE DATOS Y UTILIZAR CLASES DE BOOSTRAP

Como muchas personas ya saben, Bootstrap es una biblioteca de front-end libre y de código abierto p...

TENDENCIAS DE DESARROLLO WEB PARA 2017

Usted verá en este post tendencias para 2017 en Diseño Web, en el medio digital y en el desarrollo...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.