V
Victor Hannak
I have a class like this:
<LarryClass.h>
class LarryClass {
public:
struct MoeLinkedListStruct {
LarryClass *Larry;
float MoeValue;
MoeLinkedListStruct *NextMoe;
};
LarryClass();
~LarryClass();
void Eval(float Value, MoeLinkedListStruct *&MoePtr);
private:
.....
}
I also have another class wherein I would like to be able to dynamically
create a new MoeLinkedListStruct like this:
<MoeClass.h>
#include "LarryClass.h"
<MoeClass.cpp>
MoeLinkedListStruct *MoePtr = new MoeLinkedListStruct;
LarryClass *Larry = new LarryClass;
Larry->Eval(0,MoePtr);
So the question is this: how do I make the MoeLinkedListStruct visible to
LarryClass? Since the struct is defined in the public area of LarryClass,
shouldn't the above code work? Am I just missing something small? I can't
really put the structure definition into a different file, because it has a
LarryClass variable in it, so LarryClass must already be defined. What else
could I do here? By the way, the intent here is for the Eval function in
LarryClass to be able to modify MoePtr to point to a different Moe, and then
pass that back up to the MoeClass.
Thanks, Vic
<LarryClass.h>
class LarryClass {
public:
struct MoeLinkedListStruct {
LarryClass *Larry;
float MoeValue;
MoeLinkedListStruct *NextMoe;
};
LarryClass();
~LarryClass();
void Eval(float Value, MoeLinkedListStruct *&MoePtr);
private:
.....
}
I also have another class wherein I would like to be able to dynamically
create a new MoeLinkedListStruct like this:
<MoeClass.h>
#include "LarryClass.h"
<MoeClass.cpp>
MoeLinkedListStruct *MoePtr = new MoeLinkedListStruct;
LarryClass *Larry = new LarryClass;
Larry->Eval(0,MoePtr);
So the question is this: how do I make the MoeLinkedListStruct visible to
LarryClass? Since the struct is defined in the public area of LarryClass,
shouldn't the above code work? Am I just missing something small? I can't
really put the structure definition into a different file, because it has a
LarryClass variable in it, so LarryClass must already be defined. What else
could I do here? By the way, the intent here is for the Eval function in
LarryClass to be able to modify MoePtr to point to a different Moe, and then
pass that back up to the MoeClass.
Thanks, Vic