Monday, March 25, 2013

What is constructor instruction in C#?

The red color part is intructing to call another contructor.
    class ListNode
    {
        private object data;
        private ListNode next;
        public ListNode(object dataValue) : this(dataValue, null)
        {
        }
        public ListNode(object dataValue, ListNode nextNode)
        {
            data = dataValue;
            next = nextNode;
        }
}

No comments:

Post a Comment