[TriLUG] OT: C++ question, linked list of objects

Rodney Radford rradford at mindspring.com
Sun Apr 2 19:09:22 EDT 2006


I'd have to disagree with making next public, especially if this is an academic assignment (most profs don't like publics, and for good reason - they make later modification of the classes more difficult due to higher maintenance).

How about turning the tables around.. instead of setting the next of the parameter object to point to yourself, set your next to point to the parameter object.  That way you only need to know your own next variable, and nothing needs to be made public.

Then, to walk the list, expose a method to traverse forward one node.

-----Original Message-----
>From: Joseph Mack NA3T <jmack at wm7d.net>
>Sent: Apr 2, 2006 5:47 PM
>To: Triangle Linux Users Group discussion list <trilug at trilug.org>
>Subject: Re: [TriLUG] OT: C++ question, linked list of objects
>
>On Sun, 2 Apr 2006, Barry Gaskins wrote:
>
>>    You either need to change the declaration of the object class to make
>> next public.
>
>hadn't thought of that
>
>> Or you can add a public method sto the object to get and set
>> the value of next.
>
>well I have the basic idea then. I was afraid I was barking 
>up the wrong tree
>
>Thanks Joe
>
>-- 
>Joseph Mack NA3T EME(B,D), FM05lw North Carolina
>jmack (at) wm7d (dot) net - azimuthal equidistant map
>generator at http://www.wm7d.net/azproj.shtml 
>Homepage http://www.austintek.com/ It's GNU/Linux!
>-- 
>TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
>TriLUG Organizational FAQ  : http://trilug.org/faq/
>TriLUG Member Services FAQ : http://members.trilug.org/services_faq/




More information about the TriLUG mailing list