Encapsulation in php
oopsphp code / August 11, 2018
<?php
class TV
{
protected $model;
private $volume;
public function volumeUp()
{
$this->volume++;
}
public function volumeDown()
{
$this->volume–;
}
public function getModel()
{
return $this->model;
}
public function __construct($m,$v)
{
$this->model=$m;
$this->volume=$v;
}
}
class plazma extends TV {
public function getModel()
{
return $this->model;
}
}
$tv=new plazma(‘abc’,1);
echo $tv->getModel();
?>