<?php
	class Cliente {
		private $id;
		private $nome;
		public function __construct($id = 0, $nome = NULL){
			$this->id   = $id;
			$this->nome = $nome;
		}
		public function getId(){
			return $this->id;
		}
		public function getNome(){
			return $this->nome;
		}
		public function setId($value){
			$this->id = $value;
			return $this;
		}
		public function setNome($value){
			$this->nome = $value;
			return $this;
		}
		
		public function __set ($name,$value){
			$this->$name = $value;
		}
		public function __get ($name){
			return $this->$name;
		}
	}
	
	
	$cliente = new Cliente();
	
	$cliente->setId(2)
	        ->setNome("Fulano 2");
	
	echo $cliente->id . " " . $cliente->nome;