[ create a new paste ] login | about

Link: http://codepad.org/mcJvXskL    [ raw code | output | fork ]

C++, pasted on Sep 1:
class ListNode//non recursive
{
public:
    int data;
    ListNode * next;
    ListNode(ListNode & in)
    {
        ListNode*src_buff = ∈
        ListNode*item = this;

        while(src_buff != NULL)
        {
            item->data = src_buff->data;
            int null__ = 0;
            ListNode *null_ = reinterpret_cast<ListNode*>(null__);
            item->next = new ListNode(*null_);

            item = item->next;
            src_buff = src_buff->next;
        }
    }
};

class ListNode//recursive
{
public:
    int data;
    ListNode * next;
    ListNode(ListNode & in)
    {
        data = in.data;

        if (in.next!=NULL)
            next = new ListNode ((const ListNode) * in.next);
        else
            next = NULL;

        return;
    }
};


Output:
1
2
Line 24: error: redefinition of 'class ListNode'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: