jarrevard 0 Newbie Poster

I am making a linked list template. a can search a string input and
determine if it is an int. i can declare a node of type int or string.

when i try to add to my list, my string node cannot point to an int
node and vice versa. here is my code that doesnt work:

void IPlist::addIntEntry()
{   /*
    node<int> *temp3; 
    node<int> *temp4; 
    temp3 = new node<int>;    

    temp3->set_IP(intEntry);     
    temp3->set_link(NULL);          

    temp4 = head_ptr->get_link();

    //links are compared so value type of IP is free to change
    while (temp4->get_link() != NULL)
    {
        temp4 = temp4->get_link();
        //move temp2 to next link
    }

    //if (temp3->get_IP() != "")
    //{
        //once temp2->get_link() = NULL
    //temp4->set_link(temp3->get_link());

    temp3->set_link(temp4->get_link());

        chain++;

    //}     

why cant a string node point to an int node?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.