Separation of interface and implementation
An argument for distinguishing between type and class is the separation of interface and
implementation. The type defines the interface and the class defines the implementation. It
is definitely necessary to be able to separate the interface of a class from its implementation,
and most object-oriented languages supports such a separation. Basically there are three
ways:
The abstract data types (ADT) approach.There are pre-defined rules for what is visible
via the interface. Often operations (methods) are visible whereas (instance) variables
are hidden. This is called the ADT-approach since an ADT is a type characterised in
terms of its operations. Smalltalk is an example of a language using the ADT-approach.
Do'stlaringiz bilan baham: |