|
-
August 22nd, 2006, 03:22 AM
#1
OOP Design
I have many years coding behind me, but I’m new to C# and OOP. I have read a book on C# and understand how to write classes etc.
I am trying to write a card game (Not poker) that involves biding, and the playing of cards.
I have the following classes and methods:-
Class :
Cards
Methods:
Shuffle
DealCards
Class :
Player (Have an array to hold the cards it has been dealt)
Methods:
Bid
Play Card
Class: Game
Method:
NewGame (to control the game).
The Game object creates a Cards object and 4 players objects which I put into an array so I can loop though for the bidding and card playing.
My questions:-
a)Logically the DealCards method should be in the Cards class, but the DealCards needs to know about the Players (number of players etc).
1) Do I pass my array of Players to the DealCards method or
2) should each Player have a GetDealtCards method or
3) should the Cards object create a DealtCards Object and if so how will it know which player to pass it too?
b) Is the general design correct or should I be using other objects and methods?
c) Is there any good books or web sites that cover how a Object Orientated program should be designed?
Thanks in Advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|