Low cost ecommerce web development India flash website design
As you can see, the controlling logic above looks for a $_GET['category'] variable.
If it exists, it creates an instance of CategoryHeader, displaying the navigation
to allow users to find their way back to the home page. But if it doesn't exist,
it creates an instance of the parent StandardHeader instead, which applies when
users view the home page (and therefore does not require bread crumbs to find
their way back).
In other words, inheritance allows us to add the extra functionality we need
without having to reproduce the logic that already resides within the parent class;
the existing methods and logic can be reused via the child subclass.
Inheritance provides a powerful mechanism to make classes that are modular,
addressing a specific problem, while still making available shared methods and
variables that can be used irrespective of the specific object we're dealing with.
Avoid Deep Inheritance Structures
As a general rule of thumb, when using inheritance to build class hierarchies,
avoid going deeper than two generations.
Inheritance in Action
Doing so is often a sign of a bad design, in which opportunities for classes
to interact in different ways (see the next solution) were missed. In practice,
having more than two generations of classes often leads to all sorts of debugging
problems and makes the code difficult to maintain. For example, it can
become hard to keep track of variable names you've used higher up in the
hierarchy.
website designer freelance ASP PHP ecommerce web developer
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110