PHP OOPs Access Specifiers
by TechVidvan Team
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>
Tags: access specifiersaccess specifiers in phpoops access specifiers in phpPHPphp access specifiersphp oops access specifiersphp practicalphp program
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.