You can define the following relationships between two object classes:
Inheritance
between two classes
Extending the functions of a class by implementing interfaces. This is a relationship between classes and interfaces
Compound interfaces
. This is a relationship between interfaces.
A friend is a relationship between a class and its users.
Characterization
Inheritance is a relationship between classes. It allows you to derive a new class from the definition of an existing class. The new class is called a subclass, the existing class is its superclass. Inheritance is used to create a subclass that is more specialized than its superclass. You can add new components to a subclass, and also redefine the methods that it inherits. The result of inheritance is a class hierarchy. The Class Builder allows you to create a class hierarchy very simply. You can create a subclass for any class that is not defined as final, and can also define a direct superclass for a class that was itself not derived.
Interfaces allow you to extend a class definition. When a class implements an interface, all the components defined in the interface appear as class components. You can access the components defined in the interface either by class or by interface reference. Interfaces allow you to work with several different classes in a uniform way. The actual implementation of the interface components takes place in the classes. Consequently, interfaces provide a way of separating the definition and implementation of components.
Interfaces can contain attributes, methods, and events, but also other interfaces. Classes that implement a compound interface must also implement all of its components. Compound interfaces are a specialization of their component interfaces.
With a friends relationship a class gives the explicitly named users access to its
PROTECTED
and
PRIVATE
components.
Features
There are the following functions:
Creating subclasses
Redefining inherited methods
Creating superclasses
Assigning interfaces to classes
Defining and implementing interface methods within a class definition