Pages

Translate

Thursday, 24 January 2013

Lesson 3 : Concept of Protecting Object Data





  
   PHP includes a full object model ,just like other object-oriented languages,allow for visibility permissions to be set on variables and methods .The keywords for doing this and their definitions are :

Public—This declares that the variable or method is fully accessible at all times.

Private –The opposite of public ,this means that the variable or method can only be seen from inside the object itself.

Protected—A middle ground between the other two options. A variable or method declared both can be accessed from within the object itself,or from within any other class that extends this one. It cannot be accessed externally.

   All Variable declarations within the class must be included by one of these terms. Methods should also be included by one of these;however,if not specified,the default permission for methods is public.

No comments:

Post a Comment