PHP OOPs Access Specifiers

Program 1

<html>
<head><title>Demo Access Specifier</title></head>
<body>
    <center>
<?php 
         class Base
         {
                protected $rno=101;
                protected $name="Rajesh Verma";
                protected $course="MTech";
         }
      // is A Relation
          class Derived extends Base
         {
             public function display()
             {
                 echo $this->rno;
                 echo $this->name;
                 echo $this->$course;
             }
                          
         }


         $d=new Derived();
         $d->display();
?>
</center>
</body>
</html>

 

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

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