T
TBass
Hi,
I want to find out the best "C++" way to do this:
I have 2 classes:
class IHost:
{
static callback(..)
}
and
#include "IHost.h"
class PluginManager:
{
....
protected:
IHost m_IHost;
}
For one function, the IHost class has to signal back to the
PluginManager class that the plugin has signalled a status change.
Before I get into what I tried, I want to first ask, what is the
proper "C++ way" of doing such a circular reference? Friend class?
Anyway, I tried this:
#include "PluginManager.h"
class IHost:
{
IHost ( PluginManager *ptr )
{
m_pPluginManager = ptr;
}
static callback(..)
protected:
PluginManager *m_pPluginManger
}
and
#include "IHost.h"
class PluginManager:
{
....
protected:
IHost m_IHost;
}
However, my compiler still won't recognize PluginManager as a class in
the IHost class definition. I've had a problem in the past that if I
try to include in a class a class that is already including that class
(like the example directly above), the compiler barfs in C++.
My next thought was to try a friend class definition, but then I
figrued I would try and find out the proper way to do this.
Thanks for any feedback in advance.
T
I want to find out the best "C++" way to do this:
I have 2 classes:
class IHost:
{
static callback(..)
}
and
#include "IHost.h"
class PluginManager:
{
....
protected:
IHost m_IHost;
}
For one function, the IHost class has to signal back to the
PluginManager class that the plugin has signalled a status change.
Before I get into what I tried, I want to first ask, what is the
proper "C++ way" of doing such a circular reference? Friend class?
Anyway, I tried this:
#include "PluginManager.h"
class IHost:
{
IHost ( PluginManager *ptr )
{
m_pPluginManager = ptr;
}
static callback(..)
protected:
PluginManager *m_pPluginManger
}
and
#include "IHost.h"
class PluginManager:
{
....
protected:
IHost m_IHost;
}
However, my compiler still won't recognize PluginManager as a class in
the IHost class definition. I've had a problem in the past that if I
try to include in a class a class that is already including that class
(like the example directly above), the compiler barfs in C++.
My next thought was to try a friend class definition, but then I
figrued I would try and find out the proper way to do this.
Thanks for any feedback in advance.
T