![]() |
| | #1 |
| Registered User Join Date: Mar 2002
Posts: 13
| My question is this. Is it right to store these arrays within the class, or should they be outside it? Im not sure myself. |
| blood.angel is offline | |
| | #2 |
| Registered User Join Date: Mar 2002
Posts: 266
| i think your asking if this array should be a class on its own or in another class? if that's what your asking it would depend on how complex each array element is. can you post code or give more details |
| blight2c is offline | |
| | #3 |
| Super Moderator Join Date: Sep 2001
Posts: 4,746
| It all depends on your style. OOP is just to help YOU organize your data - it's nothing for the computer but more work. |
| sean is offline | |
| | #4 |
| Registered User Join Date: Mar 2002
Posts: 13
| There are 2 arrays holding 153 elements between them, which create the 600 or so coordinates of the rubixs cube (27 smaller cubes, 8 vertices, 3 coordinate you do the math ).The arrays are only used when the rubixs cube is created. Is it neccessary to store the data in the class? Or is it good programming to encapsulate everything that the class can possibly use? |
| blood.angel is offline | |
| | #5 |
| Seeking motivation... Join Date: May 2002
Posts: 537
| Assuming they don't ever change I would perhaps have them as a constant array declared at the top of the rubix class file, kind of like pretending to encapsulate the data. Alternatively, you might declare them to be a static member of the class - perhaps the better option. There are any number of possibilities but I would suggest using the one that suits your programming style. |
| endo is offline | |
| | #6 |
| ¡Amo fútbol! Join Date: Dec 2001
Posts: 2,123
| I wouldn't put them in a class, unless you plan on making your program use more than one rubix (SP?) cube, and the array values will change. Just my humble opinion. |
| golfinguy4 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting an error with OpenGL: collect2: ld returned 1 exit status | Lorgon Jortle | C++ Programming | 6 | 05-08-2009 08:18 PM |
| help on class coupling | andrea72 | C++ Programming | 3 | 07-05-2006 12:15 PM |
| binary tree token problem | OldSchool | C++ Programming | 13 | 05-28-2006 10:42 PM |
| [question]Analyzing data in a two-dimensional array[with code] | burbose | C Programming | 4 | 06-14-2005 05:45 AM |
| structure vs class | sana | C++ Programming | 13 | 12-02-2002 07:18 AM |