Introduction to OOP: Chapter 3: Classes and Methods:
[next]
[previous]
[audio]
[real]
[text]
A Class Declaration
type
suits = (Heart, Club, Diamond, Spade);
colors = (Red, Black);
Card = object
(* data fields *)
suitValue : suits;
rankValue : integer;
faceUp : boolean;
(* initialization *)
procedure setRankAndSuit (c : integer; s : suits);
(* manipulation *)
function color : colors;
procedure draw (win : window; x, y: integer);
function faceUp : boolean;
procedure flip;
function rank : integer;
function suit : suits;
end;
Intro OOP, Chapter 3, Slide 17