Making your FIGURE_TYPE struct from your Figure class public can solve your problem. Presumably your FIGURE_TYPE is in the defauls private block of your class, which means you can't access it directly. Making it public allows other classes to use that struct, even if it's declared in the Figure class.
Here's a small example:
#include <iostream>
using namespace std;
#define NR 5
class SDL_Rect{};
class A{
public:
struct FIGURE_TYPE {
SDL_Rect crop;
int x;
int y;
};
};
class B{
public:
void printFig(A::FIGURE_TYPE figure_index[NR]){
for (int i=0;i<NR;i++){
cout<<"X: "<<figure_index[i].x<<" Y: "<<figure_index[i].y<<endl;
}
}
};
int main(){
A::FIGURE_TYPE figs[NR];
for (int i=0;i<NR;i++){
figs[i].x=i+10;
figs[i].y=i+20;
}
B().printFig(figs);
return 0;
}
Lucaci Andrew
Practically a Master Poster
692 posts since Jan 2012
Reputation Points: 108
Solved Threads: 98
Skill Endorsements: 13
Question Answered as of 4 Months Ago by
Suzie999
and
Lucaci Andrew