Prev | Current Page 233 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

These components are known as objects, and objects are created
from a template known as a class, which specifies what sorts of data the object might
contain and the behavior one would expect. This strategy offers several advantages:
??? The developer can change the application implementation without affecting the
object user because the user??™s only interaction with the object is via its interface.
??? The potential for user error is reduced because of the control exercised over the
user??™s interaction with the application.
Inheritance
The many objects constituting our environment can be modeled using a fairly welldefined
set of rules. Take, for example, the concept of an employee. All employees
share a common set of characteristics: name, employee ID, and wage, for instance.
However, there are many different types of employees: clerks, supervisors, cashiers,
and chief executive officers, among others, each of which likely possesses some superset
of those characteristics defined by the generic employee definition. In object-oriented
terms, these various employee types inherit the general employee definition, including
all of the characteristics and behaviors that contribute to this definition. In turn, each
of these specific employee types could be inherited by yet another more specific type.
For example, the Clerk type might be inherited by a day clerk and a night clerk, each
of which inherits all traits specified by both the employee definition and the clerk
definition.


Pages:
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245