PHP Abstraction

PHP Abstraction

Code below defined an TV class. We cannot do much with it except turning it on and off. The class TV is an abstraction of a real TV in a very simple use case.

<?php
class TV {
      private $isOn = false;
      public function turnOn() {
            $this->isOn = true;
               }
     public function turnOff() {
            $this->isOn = false;
               }
}
 $tv = new TV();
$tv->turnOn();
$tv->turnOff();
?>        

Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

*

*