Например, у меня есть:
Tile.h:
Код: Выделить всё
//
// Created by MBK on 12.11.25.
//
#ifndef PRAK_TILE_H
#define PRAK_TILE_H
#include
class Tile {
std::string currentTexture;
void doNothing() {
}
};
class Floor : public Tile { // Accessible tile, characters can enter/leave them
};
class Wall : public Tile { // Non-Accessible tile, characters can't enter them
};
class Portal : public Tile {
};
#endif //PRAK_TILE_H
Код: Выделить всё
//
// Created by MBK on 13.11.25.
//
#ifndef PRAK_CHARACTER_H
#define PRAK_CHARACTER_H
#include "header.h"
class Character{
private:
std::string Texture;
Tile* currentTile; // The tile the player is at
// To implement : AbstractUI
public:
Character(std::string_view txt) : Texture (txt){};
std::string_view getTexture() const;
void setTile(Tile* newTile);
// To implement : move()
};
#endif //PRAK_CHARACTER_H
Код: Выделить всё
//
// Created by MBK on 13.11.25.
//
#ifndef PRAK_HEADER_H
#define PRAK_HEADER_H
#include
#include "Tile.h"
#include "Character.h"
#endif //PRAK_HEADER_H
Подробнее здесь: https://stackoverflow.com/questions/798 ... each-other
Мобильная версия