T
TBass
Hi,
I've been using C for years, but I'm new to C++. For the most part it's
been smooth, but here's my current snag:
COPCClassFactor.h
===============
class COPCClassFactory
{
int someint;
....
};
COPCServer.h
==========
class COPCClassFactory;
class COPCServer
{
COPCClassFactory * pCF;
....
};
myapp.cpp
========
#include "COPCServer.h"
main()
{
COPCServer kt;
/* at this point, I want to get back to someint */
/* and change its value */
/* and I'm a little unsure as how to do that. */
/* my current attempt leaves some tasks undone */
kt.pCF->someint = 5;
/* compiler error: use of undefined type COPCClassFactory */
/* but it's just a pointer to COPCClassFactory, */
/* I still need to initalize one */
/* but myapp.cpp doesn't "see" COPCClassFactory. Doing: */
kt.pCF = new COPCClassFactory;
/* compiler error: no appropriate default constructor */
/* Do that in constructor of COPCServer class? */
}
I knew what I was typing was wrong; I'm just not sure of the proper
method. Can anyone point me in the right direction?
Thanks in advance,
TBJ
I've been using C for years, but I'm new to C++. For the most part it's
been smooth, but here's my current snag:
COPCClassFactor.h
===============
class COPCClassFactory
{
int someint;
....
};
COPCServer.h
==========
class COPCClassFactory;
class COPCServer
{
COPCClassFactory * pCF;
....
};
myapp.cpp
========
#include "COPCServer.h"
main()
{
COPCServer kt;
/* at this point, I want to get back to someint */
/* and change its value */
/* and I'm a little unsure as how to do that. */
/* my current attempt leaves some tasks undone */
kt.pCF->someint = 5;
/* compiler error: use of undefined type COPCClassFactory */
/* but it's just a pointer to COPCClassFactory, */
/* I still need to initalize one */
/* but myapp.cpp doesn't "see" COPCClassFactory. Doing: */
kt.pCF = new COPCClassFactory;
/* compiler error: no appropriate default constructor */
/* Do that in constructor of COPCServer class? */
}
I knew what I was typing was wrong; I'm just not sure of the proper
method. Can anyone point me in the right direction?
Thanks in advance,
TBJ