Defining interfaces

Defining interfaces

An interface is a type of class that is similar to a class but which is used to implement the specification of an abstraction of a class. An interface is a collection of operations used to specify the externally visible behavior of a class. It has no implementation of its own.

A class that implements all the operations in an interface is said to realize the interface. A class that requires one or more operations in an interface is said to use the interface. The interface includes the signatures of the operations of the class. Usually, an interface specifies only a limited part of the behavior of a class. A class can implement one or more interfaces.

The following example shows a Name (interface) that realizes the action

GetName for an Employee (class).

Interface properties

An interface has the following properties:

Property

Description

Name

Name of the interface

 

 

Code

Reference name for the interface

 

 

Comment

Descriptive comment for the interface

 

 

Stereotype

Subclassification of an interface derived from an

 

existing one. Extends the semantics of an interface

 

without changing it's structure

 

 

Visibility

Visibility of the interface, whose value denotes

 

how it may be seen outside its enclosing name

 

space

 

 

Generate

Indicates that the class will be automatically

 

included among the objects generated from the

 

model when you launch the generation process

 

 

Maximum length

254

254

36

Page 46
Image 46
Sybase 7.5 manual Defining interfaces, Interface properties, An interface has the following properties