"
}
?>
Please note that we can use the abstract class and implement an interface
concurrently as shown in the above example.
You cannot declare an abstract class as final, because abstract class means
it has to be extended and final class means it can't be extended. So it's
totally meaningless to use these two keywords together. PHP won't allow
you to use them together.
Similar to declaring a class as abstract, you can also declare any method as abstract.
When a method is declared as abstract, it means that the subclass must override that
method. An abstract method should not contain any body where it is defined. An
abstract method can be declared as shown here:
abstract public function connectDB();
Kick-Starting OOP
[ 36 ]
Static Method and Properties
A static keyword is very important in object oriented programming. Static
methods and properties play a vital role in application design and also in design
patterns. So what are static methods and properties?
You have already seen that to access any method or attribute in a class you must
create an instance (i.e. using new keyword, like $object = new emailer()), otherwise
you can't access them. But there is a difference for static methods and properties.
Pages:
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