I have a Header file with two classes List class and Node class. I\'m trying to
ID: 3571487 • Letter: I
Question
I have a Header file with two classes List class and Node class. I'm trying to write the .cpp file to the header file, but am having trouble. any help would be appreciated.
#ifndef LIST_H
#define LIST_H
#include <iostream>
using namespace std;
const bool NODE = true;
class List;
class Node
{
private:
Node(int other, Node* OBJ);
int data;
Node* next;
friend class List;
friend ostream& operator<<(ostream&, const List&);
};
class List
{
public:
List(int = 0);
List(const List&);
~List();
bool goToBeginning();
bool goToEnd();
bool goToNext();
bool goToPrior();
bool insertBefore(int);
bool insertAfter(int);
bool remove();
bool isEmpty() const;
bool isFull() const; // Return False by default
void clear();
List& operator=(const List&);
friend ostream& operator<<(ostream& output, const List& OBJ);
private:
Node* head;
Node* cursor;
};
#endif
Explanation / Answer
This a permission denied error. There is no problem with your code. "Id" is returned when your operating system doesn't allow to modify a file when it is in use, so the compilation fails because the compiler cannot remove the old executed file and replace it with a new one. So, simply close all the existing processes running that program.
If this doesn't work, check your permissions for directory the executable is in or for any programs that are currently using it because they may acquire some locks on that executable program. That means, the old instance of your program is still running. Windows doesn't allow to change the files which are currently in use and your linker cannot write the new .exe file on top of the running one.
As the program doesn't contain main(), it is obvious to show a bug. But sometimes, we just don't need the main() function. In that case just ignore the message.
Also check the permissions for your .exe file.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.