PHP OOP: Why a getter?

Naniisan

New Member
I'm a novice with OOP, and I'm having trouble grasping the necessity of a getter method.In the example:\[code\]class foo { $this->bar = "test";}$foo = new foo();echo $foo->bar;\[/code\]What are the potential pitfalls in this situation, assuming I'm using a setter method to properly validate an updated value?
 
Back
Top