Information Technology Reference
In-Depth Information
thus within the objects derived from them. Levels of access are assigned in order to
specify how classes, as well as their attributes and methods, can be used by other
objects during execution. While cooperation among objects is desirable, these
interactions must be controlled in order to ensure stability. The three standard
access levels are described below:
Public: the class in question, and instances of it, can be accessed by any other
member simply by a call to the class or derived object name.
Protected: can be accessed by the class itself, and by all subclasses that are
derived from it.
Private: can only be accessed by the class itself. Thus, only methods that are part
of the class are allowed access.
Access levels can be applied to individual attributes or methods within a class,
and form the basis of an interface. Those characteristics of a class which we earlier
described as the class's ''inner workings'' are designated as restricted. This might
encompass nearly all of a class's attributes and methods. Those characteristics
which are left open for access by other parts of the software system constitute the
interface, and generally will communicate with the inner workings of the class in a
predefined way in order to return information, perform an action, or modify the
object in question.
2.3.4 Delegation
In the next section, we will discuss a practice in the object-oriented paradigm
called inheritance, which aims to provide a class with the properties of a different
class. Here we briefly discuss an alternative method to this practice, known as
delegation. Delegation provides opportunity for code reuse not by directly
inheriting the attributes of some class, but rather by simply using the methods of
another class to accomplish the desired result (Bruegge and Dutoit 2004 ). While
inheritance is generally considered a static method of implementing attributes,
delegation allows the dynamic use of only those desired attributes at a specified
time.
2.4 Inheritance
Object-oriented software engineering aims to efficiently produce reliable software
by reducing redundancy and ensuring integrity within a software system. The
class-object structure facilitates this end by providing an intuitive system of
modularization which easily lends itself to reusability. Central to both of these
Search WWH ::




Custom Search