Abstract type: Difference between revisions
Content added Content deleted
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|C#}}== |
|||
<lang csharp>abstract class Class1 |
|||
{ |
|||
public abstract void method1(); |
|||
public int method2() |
|||
{ |
|||
return 0; |
|||
} |
|||
}</lang> |
|||
=={{header|C++}}== |
=={{header|C++}}== |