J
jake77.lucas
I'm using 2005.Net C++ compiler. I have a base class in namespace A
(call it Class1). I derive another class from it, (call it Class2)
defined in namespace B. This derived class contains as a member datum
a pointer to an object of type Class3 from namespace A, and thus
requires forward declaration. I attempted the following in the Class 2
hpp file:
#include "Class1.hpp" // << Base class "A::Class1" - need this of
course.
namespace B{
// >> Fwd declare class 3 from namespace A:
class A::Class3; // << Compiler can't seem to understand this fwd
declaration??
// >> Define the derived class:
class Class2 : public A::Class1
{
// >> Member data pointer to object of type A::Class3:
A::Class3* m_obj3; // << This is why I included the fwd
declaration:
};
}
What in the world is wrong with the forward declaration?
Unfortunately the only work-around that I have found is to "#include
Class3.hpp" - which I hate to do in .hpp files.
Anyone understand this?
EWL
(call it Class1). I derive another class from it, (call it Class2)
defined in namespace B. This derived class contains as a member datum
a pointer to an object of type Class3 from namespace A, and thus
requires forward declaration. I attempted the following in the Class 2
hpp file:
#include "Class1.hpp" // << Base class "A::Class1" - need this of
course.
namespace B{
// >> Fwd declare class 3 from namespace A:
class A::Class3; // << Compiler can't seem to understand this fwd
declaration??
// >> Define the derived class:
class Class2 : public A::Class1
{
// >> Member data pointer to object of type A::Class3:
A::Class3* m_obj3; // << This is why I included the fwd
declaration:
};
}
What in the world is wrong with the forward declaration?
Unfortunately the only work-around that I have found is to "#include
Class3.hpp" - which I hate to do in .hpp files.
Anyone understand this?
EWL