Answer the question
In order to leave comments, you need to log in
You need to divide the code into C++ files. Where is the mistake?
Main.cpp #include "a.hpp"
a.hpp
#ifndef A_HPP_
#define A_HPP_
#include "b.hpp"
#include "c.hpp"
#include "d.hpp"
class A: public B, public C
{
D ddd;
};
#endif
#include "a.hpp"
#ifndef B_HPP_
#define B_HPP_
#include "d.hpp"
class B{
...
D ddd;
};
#endif
#ifndef C_HPP_
#define C_HPP_
#include "d.hpp"
class C{
D ddd;
};
#endif
#ifndef D_HPP_
#define D_HPP_
class D{
};
#endif
Answer the question
In order to leave comments, you need to log in
Thanks for answers.
Thanks for answers.
The solution was not where I was looking for it. The fact is that in the d.hpp file I described all the functions of class D in the same file (there were just 2 of them and I did not want to throw them into the .cpp file)
After transferring to .cpp everything worked as it should.
If there is still a kind soul, then I will be glad to know the answer to the questions:
1. What is the difference between delaration and description of functions in a different file and in two?
2. Why did the description in one file work in some situations, but not in others?
en.wikipedia.org/wiki/Include_guard
Well, somehow you have thrashers, there are not enough classes and all that...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question