bioinf
01-03-2005, 10:51 PM
Hi, (first post)
I am a little confused as whether to use public instance fields or not. I have to write a program (in JAVA) to simulate playing rummy. I have created a class that holds my deck of cards, and shuffles them and other stuff. I have created a class to play rummy, however the only way i can get it to work is to to make the array that holds the deck of cards in the deck of cards class public. I don't think this is a very good idea as all the text books i read say "DON'T USE PUBLIC". Anyone got any ideas to get around this? I was thinking maybe return the remaining deck of cards to the play rummy class.?
Thanks
I am a little confused as whether to use public instance fields or not. I have to write a program (in JAVA) to simulate playing rummy. I have created a class that holds my deck of cards, and shuffles them and other stuff. I have created a class to play rummy, however the only way i can get it to work is to to make the array that holds the deck of cards in the deck of cards class public. I don't think this is a very good idea as all the text books i read say "DON'T USE PUBLIC". Anyone got any ideas to get around this? I was thinking maybe return the remaining deck of cards to the play rummy class.?
Thanks