Код: Выделить всё
|--project/
|--main.cpp
|--include/
| |--class1.hpp
| |--class2.hpp
|--impl/
| |--class1.cpp
| |--class2.cpp
class1.hpp
Код: Выделить всё
#ifndef CLASS1_HPP
#define CLASS1_HPP
class class1 {
private: string name;
}
#endif
Код: Выделить всё
#ifndef CLASS2_HPP
#define CLASS2_HPP
#include "class1.hpp"
class class2 {
private: Class1 class1;
}
#endif
Код: Выделить всё
#include "class1.hpp"
#include
(functions implemantations...)
}
Код: Выделить всё
#include "class2.hpp"
#include "class1.hpp"
#include
(functions implemantations...)
}
Код: Выделить всё
#include "class2.hpp"
#include
int main() {
Class2 class2;
(...)
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... ctory-in-c
Мобильная версия