944,179 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 10780
  • C++ RSS
Nov 27th, 2005
0

Linked List & Objects

Expand Post »
Are there any good tutorials out there that explain adding objects to a single linked list. All I have come across are linked lists involving "structs". regards T
Reputation Points: 10
Solved Threads: 0
Light Poster
TimC is offline Offline
42 posts
since May 2005
Nov 28th, 2005
0

Re: Linked List & Objects

Well as now one answered this ill just add the comment I had in mind when I first saw the post... in c++ structs are just classes with default access right of public, as opposed to private, so any code that can handle structs can handle objects...

however if this was a question about an object oriented solution to the linked list problem I guess that does not help much ? if you are new to c++ perhaps the list of the stl can be of intrest.
Quote originally posted by Dinkum C++ on list ...
The template class describes an object that controls a varying-length sequence of elements of type Ty. The sequence is stored as a bidirectional linked list of elements, each containing a member of type Ty.
Reputation Points: 29
Solved Threads: 4
Junior Poster in Training
perniciosus is offline Offline
78 posts
since Nov 2005
Nov 28th, 2005
0

Re: Linked List & Objects

I find it useful to think of a list as a sequence of objects, frequently called links or nodes, linked by pointers. The link/nodes can be instances of a struct/class which in turn contain both a data object and at least one pointer. In C you can only use structs to do this, as the concept of class isn't available. In C++ a struct and a class are the same thing, except that struct members default to public access and class members default to public.
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Lerner is offline Offline
2,253 posts
since Jul 2005
Nov 28th, 2005
0

Re: Linked List & Objects

SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Searching a file for a string
Next Thread in C++ Forum Timeline: please check my code and help me





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC