ENCAPSULATION
It is process of encapsulating or wrapping up member properties and methods in a single module.
If class used the Abstraction and Data Hiding then such type of class is known as encapsulation class.
class Animal{
private $name;
public function setName($name) {
$this->name = $name;
}
public function getName($name) {
return $this->name;
}
}
$animalObj = new Animal();
$animalObj ->setName('Lion');
$animalObj ->getName();
// Output
Lion
Comments
Post a Comment