I have the following classes:
The Automata
Class
#ifndef Automata_H
#define Automata_H
class Automata {
protected:
// ...
public:
virtual DFA* dfaEquivalent() {}
// ....
};
The DFA
class that inherits from Automata
#include "Automata.hpp"
#ifndef DFA_H
#define DFA_H
class DFA : public Automata
{
private:
public:
DFA() {}
};
And finnaly that inherits from DFA
:
#include "DFA.hpp"
#ifndef _NFA_H
#define _NFA_H
class NFA : public DFA
{
private:
public:
NFA() { }
DFA* dfaEquivalent()
{}
};
#endif
The problem comes when I have an instance of NFA
and I want to call dfaEquivalent
, and the compiler says the following :
g++ -c -o main.o main.cpp
In file included from DFA.hpp:1:0,
from NFA.hpp:1,
from Comparador.hpp:5,
from main.cpp:2:
Automata.hpp:96:13: error: ‘DFA’ does not name a type; did you mean ‘DFA_H’?
virtual DFA* dfaEquivalent(){}
^~~
DFA_H
<builtin>: recipe for target 'main.o' failed
make: *** [main.o] Error 1
What's the mistake I am committing with inheritance?