I have this error only on VS 2019, I did the same code in Codeblocks and it works good, I want to know if you can help me with this error.
In the class LinkedList when I try to declare the "header" and "trailer" Nodes the compiler says:
C3646 - 'header': unknown override specifier
C4430 - missing type specifier - int assumed. Note: C++ does not support default-int
C3646 - 'trailer': unknown override specifier
C4430 - missing type specifier - int assumed. Note: C++ does not support default-int
This is the code of the class LinkedList and Node, each class is in a separate ".h" file.
"LinkedList.h" :
#pragma once
#include "Node.h"
#include <iostream>
using namespace std;
class LinkedList
{
public:
LinkedList();
~LinkedList();
int getFront() const;
int getBack() const;
void addFront(int d);
void addBack(int d);
void removeFront();
void removeBack();
void PrintReverse();
void PrintForward();
private:
Node header;
Node trailer;
};
"Node.h":
#pragma once
#include <iostream>
#include "LinkedList.h"
using namespace std;
class Node
{
private:
int data;
Node* next;
Node* prev;
void addFrontN(int d);
void removeFrontN();
public:
friend class LinkedList;
};