Jump to content

Singly-linked list/Reversal: Difference between revisions

No edit summary
Line 52:
{{libheader|StdCtrls}}
 
This version uses standard Delphi concepts of block structure, passing objects, and avoiding pointers where possible. So, for example, here, the problem is broken down into a set of simple subroutines that take list-objects as arguments. While the code is slightly larger than inline examples, there are big payoffs for small increments in size. For example, the subroutines can be used independently on any linked-list. In this way, they could be used as the basis for a link-list library or linked-list object. Code-reuse is a fundamental tool for simplifying programing tasks and decreasing errors. So, in Delphi, even when you are writing simple code, the language encourages you to make it modular which makes it easy to reuse and easy to incorporate into libraries.
This version uses standard Delphi concepts of block structure, passing objects,
and avoiding pointers where possible. So, for example, here, the problem is broken
down into a set of simple subroutines that take list-objects as arguments. As a
result, they can be used independently on any linked-list. In this way, they could
be used as the basis for a link-list library or linked-list object. Code-reuse is
a fundamental tool for simplifying programing tasks and decreasing errors. So, in
Delphi, even when you are writing simple code, the language encourages you to make
it modular which makes it easy to reuse and easy to incorporate into libraries.
 
<syntaxhighlight lang="Delphi">
465

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.