// This code illustrates encapsulation (information hiding)
class Category { // constructor
// properties
private $id;
private $name;
public function __construct($id, $name) {
$this->id = $id;
$this->name = $name
}
// methods
public function getID() { // This is known as a "getter" method
return $this->id;
}
public function setID($value) { // This is know as a "setter" method
$this->id = $value;
}
public function getName() {
return $this->name;
}
public function setName($value) {
$this->name = $value;
}
}