«

My First OOP - A Solitaire Game

时间:2009-7-30 15:58     作者:fshell     分类:


I learned about the concept of the Object-oriented programming(OOP) when I was attending college some years ago.  The professor introduced the concepts of common objects such as a stack, a queue and dequeue frequently used in computer programming.  He also talked about advantage of programming in objects in general.   I still remember vividly the example he used in his lecture to illustrate the concepts, a solitaire game: The deck of cards can be thought of a stack. The up-pile can be thought of a stack. The down-pile can be thought of a queue/dequeue. A poker card can be thought of an object that has the following properties:

Value(Ace,Two,Three,Four,Six,Seven,Eight,Nine,Ten,Jack,Queen,King) Color (Red,Black) Suite (Heart,Diamond,Club,Spade) Face (Front,Back)