There is an abstract class BasicUnit:
#pragma once #include "iostream" //file BasicUnit.h using namespace std; class BasicUnit { protected: int health; public: enum UnitType {Builder, Soldier, Town, Home}; virtual void showHealth(); BasicUnit(); BasicUnit(int a); virtual ~BasicUnit(); }; From it the Builder class is inherited:
#include "BasicUnit.h" #include "Home.h" class Builder : public BasicUnit { public: Builder(); Builder(int a); int chopTree(); ~Builder(); Home buildHome(); // Ошибка здесь }; In the third class Home, I want to set the Builder as a return type, but the compiler gives an error that the Builder does not exist in BasicUnit.
#include "BasicUnit.h" #include "Builder.h" #include "iostream" using namespace std; class Home : public BasicUnit { public: Home(); Builder createBulder(); //Ошибка здесь ~Home(); }; How to make a return type Builder? thank