-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2209.php
More file actions
40 lines (32 loc) · 745 Bytes
/
2209.php
File metadata and controls
40 lines (32 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
class demoCls
{
protected $username = 'admin';
private $mysalary;
public function __construct($passingUname)
{
$this->mysalary = 20000;
$this->username = $passingUname;
}
public function printUname()
{
echo $this->username;
}
}
// $obj = new demoCls('Dilip');
// $obj->printUname();
class demoTwo extends demoCls
{
public $newusername;
public $goal;
public function __construct($passingnewUname)
{
parent::__construct('Kavya');
// $this->goal = 20;
$this->newusername = $this->username;
echo $this->newusername;
echo $this->goal ?? 100;
echo $this->mysalary ?? 40000;
}
}
$obj = new demoTwo('Yash');