Sorry if the title is unclear, it's hard to put into a sentence what my question is. I have two ADT classes, one is grid the other is blob. Grid contains only the private variables:
The blob class is friended to Grid so it should be able to use both these arrays as it's own private variables (i think). But when I try to execute Blob functions, they say that the two arrays are undefined. When using the arrays in the blob functions, I'm not passing them at all since they're priv variables. Just typing them in the blob functions as say:Code:char Blob_Data[HEIGHT - 1][WIDTH - 1]; int Visited_Blobs[HEIGHT - 1][WIDTH - 1];
Blob has both a default constructor:Code:cout << Blob_Data[row_loc][col_loc];
and another constructor:Code:Blob::Blob(){ row_loc = 0; col_loc = 0; }
In Blob's private variables I have:Code:Blob::Blob(int column, int row){ row_loc = row; col_loc = column; }
Now i'm pretty sure I'm supposed to declare a Grid object there so the arrays exist, but not sure if there or in the blob constructors is the place to do it. I was going to declare the arrays in the blob constructors also, but couldn't figure out if that was the right place, or how to code it. If i'm not clear here I can post all the code or clarify any of the code. Thanks in advance for any help.Code:private: int row_loc, col_loc; Grid G;



LinkBack URL
About LinkBacks


