I defined a new type in my first class and declared an array of this structure. I created a pointer to the array and need to pass this into another class so I can access the data in the array, but the other class won't recognize the structure that I created...
Here's the necessary code for the two classes:
class Document {
private:
struct Plaintiff{
AnsiString asName;
AnsiString asCounty;
AnsiString asState;
};
Plaintiff myPlaintiffs[5];
Plaintiff *myPtrPlaintiffs;
}
class Paragraph {
private:
public:
Paragraph(Plaintiff *myPtrPlaintiffs);
}
In the Constructor for the Document class, I put values into the array(not showing that here) and then set the ptr pointing to the first element in the array like this:
myPtrPlaintiffs = myPlaintiffs;
In another function, I now try to pass this ptr into the constructor of my Paragraph class like this:
Paragraph myParagraph(myPtrPlaintiffs);
When I call this constructor, the structure is not recognized, even though I include the header for where the structure is defined. I also tried making the structure public, but it didn't change anything. Is there a way to do this or does the structure need to be declared globally?
Any suggestions are much appreciated, I'm really stumped here. I did end up making a class instead of a structure to get it to work, but I would still prefer to do it this way.
Here's the necessary code for the two classes:
class Document {
private:
struct Plaintiff{
AnsiString asName;
AnsiString asCounty;
AnsiString asState;
};
Plaintiff myPlaintiffs[5];
Plaintiff *myPtrPlaintiffs;
}
class Paragraph {
private:
public:
Paragraph(Plaintiff *myPtrPlaintiffs);
}
In the Constructor for the Document class, I put values into the array(not showing that here) and then set the ptr pointing to the first element in the array like this:
myPtrPlaintiffs = myPlaintiffs;
In another function, I now try to pass this ptr into the constructor of my Paragraph class like this:
Paragraph myParagraph(myPtrPlaintiffs);
When I call this constructor, the structure is not recognized, even though I include the header for where the structure is defined. I also tried making the structure public, but it didn't change anything. Is there a way to do this or does the structure need to be declared globally?
Any suggestions are much appreciated, I'm really stumped here. I did end up making a class instead of a structure to get it to work, but I would still prefer to do it this way.