PHP protected classes and properties, protected from whom?

Posted by Andrew Heath on Stack Overflow See other posts from Stack Overflow or by Andrew Heath
Published on 2011-01-10T02:39:47Z Indexed on 2011/01/10 2:53 UTC
Read the original article Hit count: 301

Filed under:
|
|

I'm just getting started with OOP PHP via PHP Object-Oriented Solutions and am a little curious about the notion of protection in OOP.

The author clearly explains how protection works, but the bit about not wanting others to be able to change properties falls a bit flat.

I'm having a hard time imagining a situation where it is ever possible to prevent others from altering your classes, since they could just open up your class.php and manually tweak whatever they pleased seeing as how PHP is always in plaintext.

Caution:
    all of the above written by a beginner
    with a beginner's understanding of programming...

© Stack Overflow or respective owner

Related posts about php

Related posts about oop