Abstract type: Difference between revisions

Content deleted Content added
m ? English
Line 7:
For example in [[object-oriented programming]] abstract types can be in some languages a partial implementation of other types, which are later derived from it. Abstract type may provide implementation of some operations and/or components. Abstract types without any implementation are called '''interfaces'''. In the languages that do not support multiple [[inheritance]] ([[Ada]], [[Java]]), interfaces are usually allowed to be multiply inherited from. The languages with multiple inheritance (like [[C++]]) usually make no distinction between partially implementable abstract types and interfaces. Because the abstract type's implementation is incomplete, if any, it makes no sense to have any instances (objects) of it. Therefore an [[object-oriented programming | OO]] language would prevent creation of such objects.
 
In strongly statically typed languages, abstract types can be used for example to hide the implementation of a type in the interface of a module. So both the complexity is hidden for the user of the module, and also the implementation can change without repercutions foron the source code that use it. Abstract types that even have no definition in the implementation can also be used for the type algebra.
 
'''Task''': show how an abstract type can be declared in the language. If the language makes a distinction between interfaces and partially implemented types illustrate both.