0

I am trying to develop a function in a linked list that outputs in a specific manner however I am getting compile errors.
Tis is the code:

listelement.h

virtual void out(ofstream& myfile) = 0;

list.h
includes listelement.h

void OutList(ofstream& myfile);

list.cc
includes list.h

void List::OutList(ofstream &myfile){
    
    ofstream file;
    file.open("tris.dat");
    
    if(myfile.is_open()){
        ListElement *current;
    
        for (current = head; current != NULL; current = current->next){
            current->out(myfile);
        }
    }
    else
        cerr << "Unable to open tris.dat" << endl;
    file.close;
}

error: statement cannot resolve address of overloaded function
which is in the line of file.close in list.cc

Please help?!

Edited by ollie60: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ollie60
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.