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?!

Replace

file.close;

with

file.close();

Thanks!

I can't believe I missed that

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.