- Encapsulation is a concept where we encapsulate all the data and member functions together to form an object.
- Wrapping up data member and method together into a single unit is called Encapsulation.
- Encapsulation also allows a class to change its internal implementation without hurting the overall functioning of the system.
- Binding the data with the code that manipulates it.
- It keeps the data and the code safe from external interference.
function __construct($n, $a)
public function setAge($ag)
public function display()
echo "welcome ".$this->name."<br/>";
echo "You are ".$person->display()." years old";