bakerre@tawc1.eglin.af.mil (Baker, Robert E.) (04/26/91)
Hello, all:
I have a (hopefully) rather simple question about OOP. I can grasp the
BASIC concepts, but one problem I'm having is determining how far 'down the
pole' to define an object. Consider the following non-OOP code (this is from
a statistics package I'm currently working on (forgive me if a little Ada code
happens to sneak in here :-) )):
{--------- 8< --- 8< --- 8< -----------}
type roster_size_type = 0..40;
hit_stat_type = (GMSPLAYED,ATBATS,HITS,SCORED,HOMERUNS,RBIS,STOLEN);
pitch_stat_type = (GMSPITCH,INNINGS,WINS,LOSSES,SAVES,EARNED,STRIKEOUTS);
hit_array_type = array [hit_stat_type] of integer;
pitch_array_type = array [pitch_stat_type] of integer;
player_type = (HITTER,PITCHER);
player_record = record
name : string;
team : string[3];
case ptype:player_type of
HITTER : (HSTATS : hit_array_type);
PITCHER : (PSTATS : pitch_array_type);
end;
var player : player_record;
team : array [roster_size_type] of player_record;
{--------- 8< --- 8< --- 8< -----------}
Now the questions. First, what CAN be declared an object? What SHOULD
be declared an object? What would be the best way to set this up? I know the
team variable can inherit the properties of the player_record type (object),
but I'm not sure how any of it should be set up.
I would REALLY like to finally take the dive into OOP, but taking the
first step is giving me a headache.
ADVthanksANCE,
+----------------------------------+------------------------------------------+
| Robert E. Baker | Question of the Week: |
| BAKERRE@TAWC1.EGLIN.AF.MIL | Will the 'Rocket' play for the Raiders? |
| USAF Tactical Air Warfare Center | Answer:_________________________________ |
+----------------------------------+------------------------------------------+