Abstract type: Difference between revisions
Content deleted Content added
m →{{header|Java}}: Changed the name of the interface class |
m Typos |
||
Line 2: | Line 2: | ||
[[Category:Encyclopedia]] |
[[Category:Encyclopedia]] |
||
[[Category:Object oriented]] |
[[Category:Object oriented]] |
||
'''Abstract type''' is a type without instances. In [[object-oriented programming]] abstract types are used for 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++]]) |
'''Abstract type''' is a type without instances. In [[object-oriented programming]] abstract types are used for 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. |
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. |
||
Line 31: | Line 31: | ||
end record; |
end record; |
||
overriding procedure Finalize (X : in out Node); -- Removes the node from its list if any |
overriding procedure Finalize (X : in out Node); -- Removes the node from its list if any |
||
overriding procedure Dequeue (Lounge : in out |
overriding procedure Dequeue (Lounge : in out Node; Item : in out Element); |
||
overriding procedure Enqueue (Lounge : in out |
overriding procedure Enqueue (Lounge : in out Node; Item : in out Element); |
||
procedure Process (X : in out Node) is abstract; -- To be implemented |
procedure Process (X : in out Node) is abstract; -- To be implemented |
||
</ada> |
</ada> |