Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition
by Paul J. Deitel - Deitel & Associates, Inc., Harvey M. Deitel - Deitel & Associates, Inc.
24.3. Self-Referential Classes
Aself-referential class contains a reference member that refers to an object of the same class type. For example, the class declaration in Fig. 24.1 defines the shell of a self-referential class named Node. This type has two Private instance variables—Integer dataValue and Node reference nextNodeReference. Member nextNodeReference references an object of type Node, an object of the same type as the one being declared here—thus the term “self-referential class.” Member nextNodeReference is referred to as a link (i.e., nextNodeReference can be used to “tie” an object of type Node to another object of the same type). Class Node also has two properties—one for instance variable dataValue (named Data) and another for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access