Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class employee{
- public $name;
- public $age;
- public $salary;
- function __construct($n, $a, $s){
- $this->name = $n;
- $this->age = $a;
- $this->salary = $s;
- }
- function info(){
- echo "<h3>Employee info</h3><br>";
- echo "Employee name : ".$this->name."<br>";
- echo "Employee age : ".$this->age."<br>";
- echo "Employee salary : ".$this->salary."<br>";
- }
- }
- class manager extends employee{
- public $ta = 1000;
- public $phone_bill = 300;
- public $total_salary;
- function info(){
- $this->total_salary = $this->salary + $this->ta + $this->phone_bill;
- echo "<h3>Manager info</h3><br>";
- echo "Manager name : ".$this->name."<br>";
- echo "Manager age : ".$this->age."<br>";
- echo "Manager salary : ".$this->total_salary."<br>";
- }
- }
- $e1 = new employee("Emran", 21, "5000");
- $e1->info();
- $e2 = new manager("Yousuf", 23, "10000");
- $e2->info();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement