Solved

Singly linked list

Posted on 2007-03-21
8
335 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

803 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