Saturday, December 12, 2015

Object's Attribute



   >>> In object oriented programming terminology, this data is called attributes. In our example, as shown in figure below, employee attributes could be Social Security number, date of birth, gender, phone number and so on.


   >>> The attributes contain the information  that differentiates between the various objects, in this case the employees.

   >>> Programming problem is analysed in terms of objects and nature of communication between them. When a program is executed, objects interact with each other by sending messages.


   >>> Behaviour of an object or Method.

          >>> The behaviour of an object is what the object can do.
          >>> An object's attributes.

   >>> In Procedural languages, the behaviour is defined by procedures, functions, subroutines. In object oriented programming terminology, these behaviours are contained in methods, and you invoke a method by sending a message to it.

   >>> In our employee example, consider that one of the behaviours required of an employee object is to set and return the values of the various attributes. Thus, each attribute would have corresponding methods, such as setGender() and gerGender().

   >>> In this case, when another object needs this information, it can send a message to an employee object and ask it what its gender is,

No comments:

Post a Comment