Encapsulation (computer programming): Difference between revisions

Content deleted Content added
Naasking (talk | contribs)
Classes are not the only means of encapsulation, ie. Javascript is an OO language that supports encapsulation but it has no classes, and you don't need to simulation classes to acheive encapsulation.
As information hiding mechanism: Removed superfluous info; maintaining neutral point of view
Line 57:
}
</source>
PHP offers the advantage of plain and simple. The purpose of these 3 categories is SCOPE.
* Public - The method is publicly available and can be accessed by all subclasses.
* Protected - the method/function/property is available to the parent class and all inheriting classes or we call them subclasses or child classes.
* Private - the method is private and only available to the parent class/base class.
 
Below is an example in PHP: