Object-Oriented Databases (Cont.)
Objects with a common structure and common behavior are grouped into
classes
. Each object is an
instance
of one class.
The state of an object can be accessed by passing messages.
If an object receives a message that it understands, the execution of an associated method is initiated.
Objects communicate by exchanging messages (
message passing
).
For example, a School object asks the Student object for its name by sending it a message asking for its name.
The receiving Student object returns the name back to the sending object.
Classes are arranged in a hierarchy which is implied by defining a class as a specialization of one or several other classes.
The subordinate classes are called
subclasses
and the superordinate classes are referred to as
superclasses
.
Subclasses inherit the structure and behavior of their superclasses.
If a subclass provides a specific structure and behavior, this will
override
inheritance.
Inheritance
conflicts
may arise if multiple inheritance takes place. They must be solved by the programmer or the system.