Wednesday, December 9, 2009

Setters and Getters in Access Modifiers

The setter and getter method handlers agrees to read/write the values

class SetterGetterExample{
private $a=1;
public function get_a(){
return $this->a;
public function set_a($value){

$example=new SetterGetterExample();

//echo $example->a;

echo $example->get_a();
echo "
echo $example->get_a();

Dynamically set and get variable values. This is an abstract class that can be used to dynamically add variables to any class.

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off