My question boils down to how do I access a member of a class within another class, that's a member of that class? For example, in the below classes, both Grid2D and Cell are a type of Rect2D. Cell is contained within (and a member of) Grid2D. I will eventually initialize Grid2D to accept a number of rows and columns, stored in private variables of similar name. HOW do I access these variables within Cell? The reason I want to access them is because Rect2D contains a point value location, and to determine the location of Cell 14, for example, I need to know the number of rows and columns in the grid.
Friend relationships won't work, I've tried. However, I was able to find a solution. Thanks for the help anyway, though. The answer seems to be with nested classes. The code below works.