Solved

Singly linked list

Posted on 2007-03-21
8
331 Views
Last Modified: 2010-04-16
Hi, I have this code:

public class IntNodoLSL
    {
        public int info;
        public IntNodoLSL next;
        public IntNodoLSL(int i)
        {
            this(i, null);
        }
        public IntNodoLSL(int i, IntNodoLSL n)
        {
            info = i; next = n;
        }
    }

it creates a node for a singly linked list but in the line this(i,null) when I compile it it marks an error "Method name expected" what can be wrong?

Thank you!!!
0
Comment
Question by:gothic130
  • 5
  • 3
8 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18766509
try ...

this.IntNodoLSL(i, null);

also why write this when there is already a LinkedList<T> class? :)
0
 

Author Comment

by:gothic130
ID: 18766567
Could you explain this:    "also why write this when there is already a LinkedList<T> class?"
maybe my problem is that I don't realy understand the code!

thank you!
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18766622
I mean why write a SinglyLinked list when there is a class in the framework already that is a linkedlist :)
0
 

Author Comment

by:gothic130
ID: 18766653
Could you tell me where is it???

:)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 37

Accepted Solution

by:
gregoryyoung earned 50 total points
ID: 18766706
http://msdn2.microsoft.com/en-us/library/he2s3bh7.aspx its doubly linked but close enough :)

0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18766726
you mat also want to look at List<T> which is a list implemented as a dynamically sized array.
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 18766748
whoops missed that they were constructors for your original question the answer to that is change it to ...


        public IntNodoLSL(int i) :  this(i, null);
        {
        }
0
 

Author Comment

by:gothic130
ID: 18766788
You are right!!!!   Thank you very much!  It works now:

public IntNodoLSL(int i) :  this(i, null)
{
}
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now