-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathFinal.php
86 lines (77 loc) · 1.13 KB
/
Final.php
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @author RAJERISON Julien
*
* Final class et methode
*/
/**
* Class A
*/
final class A
{
/**
* @param $a
* @param $b
* @return float|int
*/
final function doSomething($a, $b)
{
return $a * $b;
}
}
/**
* Class b return error final class not extended
*/
class B extends A
{
// CLASS: may not inherit to final class
}
/**
* Instanciation A to D
*
* Class Jul
*/
class Jul
{
private $a;
/**
* d constructor.
* Call A Method to constructor
* @param A $a
*/
public function __construct(A $a)
{
$this->a = $a;
}
/**
* calc $a $b return not error
*/
public function calcAb()
{
return $this->a->doSomething(1, 2);
}
final function is_jul()
{
return true;
}
}
/**
* Class Mickie
*/
class Mickie extends Jul
{
/**
* @return bool|void
*/
public function is_jul()
{
// Cannot override final methode
}
/**
* @return float|int
*/
public function calcAb()
{
return parent::calcAb(); // TODO: Change the autogenerated stub
}
}