Solved

Singly linked list

Posted on 2007-03-21
8
333 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

14 Experts available now in Live!

Get 1:1 Help Now