M
mscava
I have 2 classes - Widget and Dialog. Dialog IS Widget. It contains
vector of Widgets. Widget get passed pointer to Dialog in constructor.
So both classes need to know about themselves.
//------------------------------------------------------------------
Dialog.hpp
//------------------------------------------------------------------
#include "Widget.hpp"
class Dialog : public Widget
{
vector<Widget*> widgets_;
};
//------------------------------------------------------------------
Widget.hpp
//------------------------------------------------------------------
class Dialog;
class Widget
{
Widget( Dialog* parent );
};
The problem is that whenever I try to declare Dialog variable compiler
outputs that Dialog has incomplete type... Any suggestions?
vector of Widgets. Widget get passed pointer to Dialog in constructor.
So both classes need to know about themselves.
//------------------------------------------------------------------
Dialog.hpp
//------------------------------------------------------------------
#include "Widget.hpp"
class Dialog : public Widget
{
vector<Widget*> widgets_;
};
//------------------------------------------------------------------
Widget.hpp
//------------------------------------------------------------------
class Dialog;
class Widget
{
Widget( Dialog* parent );
};
The problem is that whenever I try to declare Dialog variable compiler
outputs that Dialog has incomplete type... Any suggestions?