Simple OOP-related question.
Posted
by M4design
on Stack Overflow
See other posts from Stack Overflow
or by M4design
Published on 2010-05-10T11:45:46Z
Indexed on
2010/05/10
11:54 UTC
Read the original article
Hit count: 189
This question came to my mind quite a few times.
Let my explain my question through an example.
Say I've got two classes: 1- Grid. 2- Cell.
Now the location of the cell 'should' be stored in the grid class, not in the cell class itself. Say that the cell wanted to get its location through a method in the grid.
How can it do that? Keep in mind that the cell was created/initialised by the Grid class.
What good OO approach to solve this problem?
Thank you
© Stack Overflow or respective owner