PHP 5 gives us everything we would expect in this area. In previous versions of PHP there was no support for data protection, meaning that all elements of a class were publicly accessible. This lack of access modifiers was probably the biggest disincentive to using objects in PHP 4.
A notion closely related to data protection is information hiding. Access modifiers make information hiding possible by exposing an interface. This is also referred to as encapsulation of an object.
No comments:
Post a Comment