class BaseClass
{
public:
virtualvoid Load(std::string msg);
};
And a derive class
1 2 3 4 5 6
#include "header.h"
class DeriveClass : public BaseClass
{
public:
DeriveClass();
};
And a class that will call the derive
1 2 3 4 5 6 7
#include "Header.h"
class Game
{
private:
static DeriveClass c1;
};
I always got this Unknow Overried specifier.
But I already define if on my baseclass.cpp
1 2 3 4
void BaseClass::Load(std::string msg) {
//some stuff here
}
also I have a pragma once on my
header.h
1 2 3 4
#pragma once
#include "BaseClass.h"
#include "DeriveClass.h"
#include "Game.h"
So it means any of that header will only be declared if others have not declared it yet.
But still I got that error
However if I never include a header.h on Derive class and just put #include "BaseClass.h"
It just works fine. How did that happen? It shows an error when using the header file which contains all the header of all classes and yet works fine when using baseclass.h?
Severity Code Description Project File Line
Error C3646 'c1': unknown override specifier ConsoleApplication1
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ConsoleApplication1