Solved

Singly linked list

Posted on 2007-03-21
8
336 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

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

:)
0
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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