I'll try to give real world examples to help you through it (even though they might not be rigorous enough for some people on StackOverflow...). This might not directly represent what you have to do for your assignment (since we don't have much details), but at least it should help you understand better.
A class is kind of a type. By this, I mean it is to be treated like and type of object (real world ones). A Card
object is something that has a Value
(1,2,3,... J,Q,K) and a Type
(Spade, Heart, etc), which could be implemented as private attributes. You would then write a getValue()
and getType()
member to return those attributes value.
You would then have a DeckOfCards
, which might be implemented as a custom class which contains a collection of Card
objects and methods to manipulate it, such as shuffleCards()
, getCardOnTopOfDeck()
, resetDeck()
, etc.
As you can see, those are made to help you build a game in a more "real world oriented code". You would start a game by creating a deck (calling DeckOfCards
constructor), then giving cards to each player (getCardOnTopOfDeck()
, which would have to remove it from the collection of Card
objects contained in the DeckOfCards
object). I think you can extrapolate from here.