I'm writing a game engine (using SFML libraries) and I can't seem to get this to work. I'm writing the GUI portion of code and I want to declare a object of the same class inside itself (parent/child so I can link objects together). I can't do this unless the class is finished being instantiated. Is there some sort of makeshift way I can force the child and parent variables to somehow work?
#ifndef ELEMENT_H
#define ELEMENT_H
#include <iostream>
class Element
{
public:
Element();
private:
int id, position_x, position_y, pixel_x, pixel_y, width, height;
Element parent;
std::vector<Element> child;
};
#endif // ELEMENT_H
Error I get:
include\Element.h|13|error: field 'parent' has incomplete type 'Element'|