-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabstract.php
More file actions
42 lines (28 loc) · 727 Bytes
/
Copy pathabstract.php
File metadata and controls
42 lines (28 loc) · 727 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
41
42
<?php
abstract class AbstractClass{
abstract protected function getValue();
abstract protected function prefixValue($prefix);
public function printOut(){
print $this->getValue();
}
}
class concreteClass1 extends AbstractClass{
protected function getValue(){
echo "Concrete Class 1";
}
public function prefixValue($prefix){
echo "{$prefix} ConcreteClass 1";
}
}
class concreteClass2 extends AbstractClass{
protected function getValue(){
echo "Concrete Class 2";
}
public function prefixValue($prefix){
echo "{$prefix} ConcreteClass 2";
}
}
$class1 = new concreteClass1();
$class1->printOut();
$class1->prefixValue("Hello");
?>