Abstract type: Difference between revisions
Content added Content deleted
m (Fixed alphabetic position) |
No edit summary |
||
Line 47: | Line 47: | ||
procedure Process (X : in out Node) is abstract; -- To be implemented</lang> |
procedure Process (X : in out Node) is abstract; -- To be implemented</lang> |
||
Here Node is an abstract type that is inherited from Limited_Controlled and implements a node of a [[Doubly-Linked List (element) | doubly linked list]]. It also implements the interface of a queue described above, because any node can be considered a head of the queue of linked elements. For the operation Finalize an implementation is provided to ensure that the element of a list is removed from there upon its finalization. The operation itself is inherited from the parent type Limited_Controlled and then overridden. The operations Dequeue and Enqueue of the Queue interface are also implemented. |
Here Node is an abstract type that is inherited from Limited_Controlled and implements a node of a [[Doubly-Linked List (element) | doubly linked list]]. It also implements the interface of a queue described above, because any node can be considered a head of the queue of linked elements. For the operation Finalize an implementation is provided to ensure that the element of a list is removed from there upon its finalization. The operation itself is inherited from the parent type Limited_Controlled and then overridden. The operations Dequeue and Enqueue of the Queue interface are also implemented. |
||
=={{header|Aikido}}== |
|||
An abstract class contains functions that have no body defined. You cannot instantiate a class that contains abstract functions. |
|||
<lang aikido>class Abs { |
|||
public function method1... |
|||
public function method2... |
|||
}</lang> |
|||
Interfaces in Aikido define a set of functions, operators, classes, interfaces, monitors or threads (but no variables) that must be implemented by a class implementing the interface. |
|||
<lang aikido>interface Inter { |
|||
function isFatal : integer |
|||
function operate (para : integer = 0) |
|||
operator -> (stream, isout) |
|||
}</lang> |
|||
=={{header|C}}== |
=={{header|C}}== |