-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path20.php
More file actions
65 lines (52 loc) · 1.55 KB
/
20.php
File metadata and controls
65 lines (52 loc) · 1.55 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php //Herança
class aula21
{ // private e Protecd
protected $var1 = "A persistencia é o caminho do exito...";
protected $var2 = "Até qui ja codei 21 aulas...";
protected $var3 = "Breve novas codificações...";
function escreve()
{
echo "<br/>Metodo da classe aula21<br/>";
echo "<br/>".$this->var1;
echo "<br/>".$this->var2;
echo "<br/>".$this->var3;
}
}
// Herança
class foco extends aula21
{
var $vc1 = "Codificando em PHP";
var $vc2 = "Luis Henrique S F";
function escreve2()
{
echo "<br/>Metodo da classe foco<br/>";
echo "<br/>".$this->vc1;
echo "<br/>".$this->vc2;
echo "<br/>".$this->var1;
echo "<br/>".$this->var2;
echo "<br/>".$this->var3;
}
}
$aulaOBJ = new aula21();
$focoOBJ = new foco();
$aulaOBJ->escreve();
echo "<br/><hr/>";
//$focoOBJ->escreve();
echo "<br/><hr/>";
$focoOBJ->escreve2();
echo "<br/><hr/>";
//echo "<br/>".$this->var1;
//echo "<br/>".$this->var2;
//echo "<br/>".$this->var3;
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>21 aulda de PHP - Classes parte 2 Herança </title>
</head>
<body>
</body>
</html>