home *** CD-ROM | disk | FTP | other *** search
Unknown | 1993-06-20 | 15.9 KB |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was not able to be converted.
This format is not currently supported by dexvert.
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Wanton Packer Module (music/wantonPacker)
| ext
| Supported |
100%
| file
| data
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 00 00 00 00 00 00 01 | 04 00 3e fc 04 00 3f a0 |........|..>...?.|
|00000010| 04 00 02 b1 04 00 02 b9 | 04 00 02 0c 00 1e 2d cc |........|......-.|
|00000020| 00 1e 2d d4 00 1e 2d 4c | 00 05 48 24 00 1e 2d d8 |..-...-L|..H$..-.|
|00000030| 00 00 00 00 00 00 00 00 | 00 04 00 00 00 00 00 00 |........|........|
|00000040| 09 00 00 00 00 00 00 00 | 00 00 00 00 01 00 fd df |........|........|
|00000050| 00 00 00 27 02 64 00 00 | 02 21 00 2b 1b 70 00 a2 |...'.d..|.!.+.p..|
|00000060| 1c b7 01 ab 00 39 00 00 | 00 00 ff 00 00 00 00 00 |.....9..|........|
|00000070| 00 00 00 00 00 00 01 01 | 02 64 00 00 00 48 00 48 |........|.d...H.H|
|00000080| 00 01 00 18 03 18 02 64 | 00 00 00 00 02 da 02 2f |.......d|......./|
|00000090| 00 64 00 04 19 00 04 00 | 08 1d 00 1e fe 30 00 48 |.d......|.....0.H|
|000000a0| 00 2a 04 00 08 1d 00 1e | fe 30 00 48 00 2a fc 71 |.*......|.0.H.*.q|
|000000b0| 00 00 02 54 00 00 00 00 | ff 00 00 00 00 00 00 00 |...T....|........|
|000000c0| 3f ba 00 00 3f ba 00 00 | 3f ba 00 00 c8 a9 00 00 |?...?...|?.......|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 04 00 3d 98 | 04 00 3e 3c 04 00 02 b1 |......=.|..><....|
|00000110| 04 00 02 b9 04 00 02 0c | 00 05 5a c0 00 05 49 68 |........|..Z...Ih|
|00000120| 00 05 5b 60 00 05 5c 78 | 00 05 5c 18 00 00 00 00 |..[`..\x|..\.....|
|00000130| 00 00 00 00 00 04 00 00 | 00 00 00 00 09 00 00 00 |........|........|
|00000140| 00 00 00 00 ff 00 00 00 | 01 00 fd df 00 00 00 27 |........|.......'|
|00000150| 02 64 00 00 02 21 00 2b | 1b 70 00 a2 1c b7 01 ab |.d...!.+|.p......|
|00000160| 00 39 00 00 00 00 ff 00 | 00 00 00 00 00 00 00 00 |.9......|........|
|00000170| 00 00 01 01 02 64 00 00 | 00 48 00 48 00 01 00 18 |.....d..|.H.H....|
|00000180| 03 18 02 64 00 00 00 00 | 02 da 02 2f 00 64 00 04 |...d....|.../.d..|
|00000190| 19 00 04 00 08 1d 00 1d | fe 30 00 48 00 2a 04 00 |........|.0.H.*..|
|000001a0| 08 1d 00 1d fe 30 00 48 | 00 2a fc 71 00 00 01 15 |.....0.H|.*.q....|
|000001b0| 00 00 00 00 00 ff 00 00 | 00 00 00 00 3e 56 00 00 |........|....>V..|
|000001c0| 3e 56 00 00 3e 56 00 00 | c8 a9 00 00 00 00 00 00 |>V..>V..|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 00 04 0d 0d 0d 0d 00 04 | 0d 0d 0d 0d 00 78 00 03 |........|.....x..|
|00000210| 00 00 00 48 00 48 00 00 | 00 00 02 da 02 2f 00 00 |...H.H..|...../..|
|00000220| 00 00 03 18 02 64 01 5b | 05 28 03 fc 00 02 00 00 |.....d.[|.(......|
|00000230| 00 48 00 48 00 00 00 00 | 03 18 02 64 00 01 00 00 |.H.H....|...d....|
|00000240| 00 64 00 00 00 01 00 01 | 01 01 00 00 00 01 27 0f |.d......|......'.|
|00000250| 00 01 00 01 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 02 00 19 01 90 00 00 | 00 00 00 40 00 00 00 00 |........|...@....|
|00000270| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000280| 00 00 00 00 00 00 00 29 | ff 00 15 09 00 f7 f9 03 |.......)|........|
|00000290| f7 fd 03 f7 f9 00 f7 ff | 00 15 0a 00 f7 4e 65 77 |........|.....New|
|000002a0| 73 77 65 65 6b 20 41 70 | 72 69 6c 20 31 39 38 39 |sweek Ap|ril 1989|
|000002b0| 0d 00 06 24 00 02 86 00 | 0f 00 06 00 08 00 00 00 |...$....|........|
|000002c0| 01 01 8e 0d 32 2e 20 20 | 57 68 61 74 20 61 72 65 |....2. |What are|
|000002d0| 20 73 6f 6d 65 20 73 61 | 6d 70 6c 65 20 69 6e 68 | some sa|mple inh|
|000002e0| 65 72 69 74 61 6e 63 65 | 20 73 74 72 75 63 74 75 |eritance| structu|
|000002f0| 72 65 73 20 79 6f 75 20 | 6d 69 67 68 74 20 63 72 |res you |might cr|
|00000300| 65 61 74 65 3f 20 20 57 | 68 61 74 20 77 6f 75 6c |eate? W|hat woul|
|00000310| 64 20 61 6e 20 69 6e 68 | 65 72 69 74 61 6e 63 65 |d an inh|eritance|
|00000320| 20 73 74 72 75 63 74 75 | 72 65 20 66 6f 72 20 62 | structu|re for b|
|00000330| 61 6e 6b 69 6e 67 20 6f | 62 6a 65 63 74 73 20 73 |anking o|bjects s|
|00000340| 75 63 68 20 61 73 20 73 | 61 76 69 6e 67 20 61 63 |uch as s|aving ac|
|00000350| 63 6f 75 6e 74 73 2c 20 | 63 68 65 63 6b 69 6e 67 |counts, |checking|
|00000360| 20 61 63 63 6f 75 6e 74 | 73 2c 20 61 6e 64 20 62 | account|s, and b|
|00000370| 61 6e 6b 69 6e 67 20 74 | 72 61 6e 73 61 63 74 69 |anking t|ransacti|
|00000380| 6f 6e 73 20 6c 6f 6f 6b | 20 6c 69 6b 65 3f 20 20 |ons look| like? |
|00000390| 57 68 61 74 20 66 69 65 | 6c 64 73 20 77 6f 75 6c |What fie|lds woul|
|000003a0| 64 20 74 68 65 79 20 68 | 61 76 65 20 69 6e 20 63 |d they h|ave in c|
|000003b0| 6f 6d 6d 6f 6e 3f 20 20 | 57 68 61 74 20 66 69 65 |ommon? |What fie|
|000003c0| 6c 64 73 20 77 6f 75 6c | 64 20 62 65 20 75 6e 69 |lds woul|d be uni|
|000003d0| 71 75 65 3f 20 20 57 68 | 61 74 20 77 6f 75 6c 64 |que? Wh|at would|
|000003e0| 20 61 6e 20 69 6e 68 65 | 72 69 74 61 6e 63 65 20 | an inhe|ritance |
|000003f0| 73 74 72 75 63 74 75 72 | 65 20 66 6f 72 20 65 6c |structur|e for el|
|00000400| 65 63 74 72 69 63 61 6c | 20 63 6f 6d 70 6f 6e 65 |ectrical| compone|
|00000410| 6e 74 73 20 6c 69 6b 65 | 20 77 69 72 65 73 2c 20 |nts like| wires, |
|00000420| 72 65 73 69 73 74 6f 72 | 73 2c 20 63 61 70 61 63 |resistor|s, capac|
|00000430| 69 74 6f 72 73 20 61 6e | 64 20 74 72 61 6e 73 69 |itors an|d transi|
|00000440| 73 74 6f 72 73 20 6c 6f | 6f 6b 20 6c 69 6b 65 3f |stors lo|ok like?|
|00000450| 0d 03 49 0d 49 6d 61 67 | 69 6e 65 20 77 68 61 74 |..I.Imag|ine what|
|00000460| 20 74 68 65 20 77 6f 72 | 6c 64 20 77 6f 75 6c 64 | the wor|ld would|
|00000470| 20 62 65 20 6c 69 6b 65 | 20 69 66 20 74 68 65 20 | be like| if the |
|00000480| 6f 6e 6c 79 20 70 65 6f | 70 6c 65 20 77 68 6f 20 |only peo|ple who |
|00000490| 63 6f 75 6c 64 20 64 72 | 69 76 65 20 61 20 63 61 |could dr|ive a ca|
|000004a0| 72 20 77 65 72 65 20 74 | 68 65 20 70 65 6f 70 6c |r were t|he peopl|
|000004b0| 65 20 77 68 6f 20 63 6f | 75 6c 64 20 61 73 73 65 |e who co|uld asse|
|000004c0| 6d 62 6c 65 20 61 6e 20 | 69 6e 74 65 72 6e 61 6c |mble an |internal|
|000004d0| 20 63 6f 6d 62 75 73 74 | 69 6f 6e 20 65 6e 67 69 | combust|ion engi|
|000004e0| 6e 65 2e 20 20 57 65 20 | 63 65 72 74 61 69 6e 6c |ne. We |certainl|
|000004f0| 79 20 77 6f 75 6c 64 6e | 27 74 20 68 61 76 65 20 |y wouldn|'t have |
|00000500| 74 68 65 20 74 72 61 66 | 66 69 63 20 70 72 6f 62 |the traf|fic prob|
|00000510| 6c 65 6d 73 20 77 65 20 | 68 61 76 65 20 74 6f 64 |lems we |have tod|
|00000520| 61 79 2e 20 20 42 75 74 | 20 77 68 61 74 20 77 65 |ay. But| what we|
|00000530| 20 68 61 76 65 20 69 6e | 20 63 61 72 73 20 69 73 | have in| cars is|
|00000540| 20 61 20 73 69 6d 70 6c | 69 66 69 65 64 20 75 73 | a simpl|ified us|
|00000550| 65 72 20 69 6e 74 65 72 | 66 61 63 65 3a 20 61 20 |er inter|face: a |
|00000560| 73 74 65 65 72 69 6e 67 | 20 77 68 65 65 6c 2c 20 |steering| wheel, |
|00000570| 61 20 62 72 65 61 6b 20 | 61 6e 64 20 61 20 67 61 |a break |and a ga|
|00000580| 73 20 70 65 64 64 6c 65 | 2e 20 20 6f 62 6a 65 63 |s peddle|. objec|
|00000590| 74 20 62 61 73 65 64 20 | 63 6f 6d 70 75 74 69 6e |t based |computin|
|000005a0| 67 20 70 6c 61 74 66 6f | 72 6d 73 20 67 69 76 65 |g platfo|rms give|
|000005b0| 20 75 73 20 74 68 65 73 | 65 20 73 61 6d 65 20 61 | us thes|e same a|
|000005c0| 64 76 61 6e 74 61 67 65 | 73 3a 20 65 61 73 79 20 |dvantage|s: easy |
|000005d0| 74 6f 20 75 73 65 20 69 | 6e 74 65 72 66 61 63 65 |to use i|nterface|
|000005e0| 73 20 74 6f 20 74 72 61 | 64 69 74 69 6f 6e 61 6c |s to tra|ditional|
|000005f0| 20 73 75 62 72 6f 75 74 | 69 6e 65 20 6c 69 62 72 | subrout|ine libr|
|00000600| 61 72 69 65 73 2e 20 20 | 54 68 69 73 20 68 65 6c |aries. |This hel|
|00000610| 70 73 20 62 6f 74 68 20 | 74 68 65 20 63 72 65 61 |ps both |the crea|
|00000620| 74 6f 72 73 20 61 6e 64 | 20 75 73 65 72 73 20 6f |tors and| users o|
|00000630| 66 20 61 20 73 75 62 2d | 72 6f 75 74 69 6e 65 20 |f a sub-|routine |
|00000640| 6c 69 62 72 61 72 79 20 | 73 79 73 74 65 6d 2e 20 |library |system. |
|00000650| 20 49 74 20 68 65 6c 70 | 73 20 74 68 65 20 63 72 | It help|s the cr|
|00000660| 65 61 74 6f 72 73 20 62 | 65 63 61 75 73 65 20 74 |eators b|ecause t|
|00000670| 68 65 69 72 20 70 6f 74 | 65 6e 74 69 61 6c 20 75 |heir pot|ential u|
|00000680| 73 65 72 20 62 61 73 65 | 20 67 6f 65 73 20 75 70 |ser base| goes up|
|00000690| 20 64 72 61 6d 61 74 69 | 63 61 6c 6c 79 2e 20 20 | dramati|cally. |
|000006a0| 54 68 69 73 20 68 65 6c | 70 20 75 73 65 72 73 20 |This hel|p users |
|000006b0| 62 65 63 61 75 73 65 20 | 74 68 65 20 61 6d 6f 75 |because |the amou|
|000006c0| 6e 74 20 6f 66 20 74 72 | 61 69 6e 69 6e 67 20 74 |nt of tr|aining t|
|000006d0| 68 65 79 20 68 61 76 65 | 20 74 6f 20 67 6f 20 74 |hey have| to go t|
|000006e0| 68 72 6f 75 67 68 20 64 | 72 6f 70 73 20 64 72 61 |hrough d|rops dra|
|000006f0| 6d 61 74 69 63 61 6c 6c | 79 2e 20 20 57 65 20 77 |maticall|y. We w|
|00000700| 69 6c 6c 20 73 65 65 20 | 74 68 61 74 20 74 68 65 |ill see |that the|
|00000710| 20 6e 75 6d 62 65 72 20 | 6f 66 20 70 65 6f 70 6c | number |of peopl|
|00000720| 65 20 77 68 6f 20 61 72 | 65 20 63 72 65 61 74 69 |e who ar|e creati|
|00000730| 6e 67 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 73 20 |ng appli|cations |
|00000740| 77 69 74 68 20 74 68 65 | 73 65 20 67 72 61 70 68 |with the|se graph|
|00000750| 69 63 20 73 75 62 72 6f | 75 74 69 6e 65 20 6c 69 |ic subro|utine li|
|00000760| 62 72 61 72 69 65 73 20 | 77 69 6c 6c 20 67 72 6f |braries |will gro|
|00000770| 77 20 65 78 70 6f 6e 65 | 6e 74 69 61 6c 6c 79 20 |w expone|ntially |
|00000780| 66 6f 72 20 74 68 65 20 | 6e 65 78 74 20 73 65 76 |for the |next sev|
|00000790| 65 72 61 6c 20 79 65 61 | 72 73 2e 0d 00 55 ff 00 |eral yea|rs...U..|
|000007a0| 15 08 01 f7 0d 0d 4f 62 | 6a 65 63 74 20 42 61 73 |......Ob|ject Bas|
|000007b0| 65 64 20 43 6f 6d 70 75 | 74 69 6e 67 3a 20 41 20 |ed Compu|ting: A |
|000007c0| 4e 65 78 74 53 74 65 70 | 20 54 75 74 6f 72 69 61 |NextStep| Tutoria|
|000007d0| 6c 20 61 6e 64 20 43 6f | 6f 6b 62 6f 6f 6b 20 2d |l and Co|okbook -|
|000007e0| 56 65 72 73 69 6f 6e 20 | 31 2e 34 20 2d 20 44 47 |Version |1.4 - DG|
|000007f0| 4d 0d 0d 00 28 0d 45 6e | 63 61 70 73 75 6c 61 74 |M...(.En|capsulat|
|00000800| 69 6f 6e 20 61 6e 64 20 | 49 6e 68 65 72 69 74 61 |ion and |Inherita|
|00000810| 6e 63 65 20 20 20 34 2d | fd 00 f7 0d 0d 04 92 fc |nce 4-|........|
|00000820| 00 48 02 0a 00 48 00 0e | 02 1c 06 30 f7 ff 00 15 |.H...H..|...0....|
|00000830| 0a 00 f7 f5 f6 ff 00 15 | 24 01 f7 43 68 61 70 74 |........|$..Chapt|
|00000840| 65 72 20 34 0d 45 6e 63 | 61 70 73 75 6c 61 74 69 |er 4.Enc|apsulati|
|00000850| 6f 6e 20 61 6e 64 20 49 | 6e 68 65 72 69 74 61 6e |on and I|nheritan|
|00000860| 63 65 0d ff 00 15 0a 00 | f7 fc 00 6c 02 0a 00 6c |ce......|...l...l|
|00000870| 00 0e 02 1c 06 30 f7 0d | 0d 0d 0d 0d 0d 0d 0d 0d |.....0..|........|
|00000880| 0d 0d 57 65 20 68 61 76 | 65 20 6a 75 73 74 20 74 |..We hav|e just t|
|00000890| 61 6b 65 6e 20 79 6f 75 | 20 6f 6e 20 61 20 77 68 |aken you| on a wh|
|000008a0| 69 72 6c 2d 77 69 6e 64 | 20 74 6f 75 72 20 6f 66 |irl-wind| tour of|
|000008b0| 20 63 72 65 61 74 69 6e | 67 20 79 6f 75 72 20 66 | creatin|g your f|
|000008c0| 69 72 73 74 20 6f 62 6a | 65 63 74 2e 20 20 57 65 |irst obj|ect. We|
|000008d0| 20 77 69 6c 6c 20 6e 6f | 77 20 74 61 6b 65 20 61 | will no|w take a|
|000008e0| 20 73 74 65 70 20 62 61 | 63 6b 20 61 6e 64 20 74 | step ba|ck and t|
|000008f0| 61 6b 65 20 61 20 6c 6f | 6f 6b 20 61 74 20 74 68 |ake a lo|ok at th|
|00000900| 65 20 64 65 74 61 69 6c | 73 20 6f 66 20 6f 62 6a |e detail|s of obj|
|00000910| 65 63 74 20 63 72 65 61 | 74 69 6f 6e 2e 0d 0d 54 |ect crea|tion...T|
|00000920| 68 65 20 6c 61 74 65 20 | 31 39 38 30 27 73 20 73 |he late |1980's s|
|00000930| 61 77 20 74 68 65 20 6d | 69 67 72 61 74 69 6f 6e |aw the m|igration|
|00000940| 20 6f 66 20 70 72 6f 67 | 72 61 6d 73 20 74 72 61 | of prog|rams tra|
|00000950| 64 69 74 69 6f 6e 61 6c | 6c 79 20 66 6f 75 6e 64 |ditional|ly found|
|00000960| 20 6f 6e 20 6c 61 72 67 | 65 20 6d 61 69 6e 66 72 | on larg|e mainfr|
|00000970| 61 6d 65 20 73 79 73 74 | 65 6d 73 20 74 6f 20 70 |ame syst|ems to p|
|00000980| 65 72 73 6f 6e 61 6c 20 | 63 6f 6d 70 75 74 65 72 |ersonal |computer|
|00000990| 20 70 6c 61 74 66 6f 72 | 6d 73 20 2d 20 77 6f 72 | platfor|ms - wor|
|000009a0| 64 20 70 72 6f 63 65 73 | 73 6f 72 73 2c 20 64 61 |d proces|sors, da|
|000009b0| 74 61 20 62 61 73 65 73 | 20 61 6e 64 20 73 70 72 |ta bases| and spr|
|000009c0| 65 61 64 20 73 68 65 65 | 74 73 20 62 65 69 6e 67 |ead shee|ts being|
|000009d0| 20 74 68 65 20 6d 6f 73 | 74 20 70 6f 70 75 6c 61 | the mos|t popula|
|000009e0| 72 2e 20 20 41 73 20 74 | 68 65 73 65 20 70 72 6f |r. As t|hese pro|
|000009f0| 67 72 61 6d 73 20 62 65 | 63 61 6d 65 20 6d 6f 72 |grams be|came mor|
|00000a00| 65 20 70 6f 70 75 6c 61 | 72 2c 20 6e 65 77 20 73 |e popula|r, new s|
|00000a10| 6f 66 74 77 61 72 65 20 | 63 6f 6d 70 61 6e 69 65 |oftware |companie|
|00000a20| 73 20 62 65 67 61 6e 20 | 65 6e 74 65 72 69 6e 67 |s began |entering|
|00000a30| 20 74 68 65 20 50 43 20 | 73 6f 66 74 77 61 72 65 | the PC |software|
|00000a40| 20 6d 61 72 6b 65 74 20 | 77 69 74 68 20 6c 65 73 | market |with les|
|00000a50| 73 20 65 78 70 65 6e 73 | 69 76 65 20 61 6e 64 20 |s expens|ive and |
|00000a60| 6d 6f 72 65 20 70 6f 77 | 65 72 66 75 6c 20 76 65 |more pow|erful ve|
|00000a70| 72 73 69 6f 6e 73 20 6f | 66 20 74 68 65 20 73 74 |rsions o|f the st|
|00000a80| 61 6e 64 61 72 64 20 70 | 72 6f 67 72 61 6d 73 2e |andard p|rograms.|
|00000a90| 20 20 54 6f 20 62 65 20 | 63 6f 6d 70 65 74 69 74 | To be |competit|
|00000aa0| 69 76 65 20 73 6f 66 74 | 77 61 72 65 20 68 61 64 |ive soft|ware had|
|00000ab0| 20 74 6f 20 62 65 20 66 | 65 61 74 75 72 65 2d 72 | to be f|eature-r|
|00000ac0| 69 63 68 20 61 6e 64 20 | 73 74 69 6c 6c 20 72 75 |ich and |still ru|
|00000ad0| 6e 20 6f 6e 20 73 79 73 | 74 65 6d 73 20 77 69 74 |n on sys|tems wit|
|00000ae0| 68 20 73 65 76 65 72 65 | 20 6d 65 6d 6f 72 79 20 |h severe| memory |
|00000af0| 6c 69 6d 69 74 61 74 69 | 6f 6e 73 2e 20 20 41 73 |limitati|ons. As|
|00000b00| 20 61 20 72 65 73 75 6c | 74 2c 20 74 68 65 20 6d | a resul|t, the m|
|00000b10| 61 72 6b 65 74 69 6e 67 | 20 64 69 76 69 73 69 6f |arketing| divisio|
|00000b20| 6e 73 20 6f 66 20 73 6f | 66 74 77 61 72 65 20 66 |ns of so|ftware f|
|00000b30| 69 72 6d 73 20 73 74 61 | 72 74 65 64 20 74 6f 20 |irms sta|rted to |
|00000b40| 70 72 6f 6d 69 73 65 20 | 6e 65 77 20 76 65 72 73 |promise |new vers|
|00000b50| 69 6f 6e 73 20 6f 66 20 | 70 72 6f 64 75 63 74 73 |ions of |products|
|00000b60| 20 77 69 74 68 20 61 20 | 6c 61 72 67 65 20 6e 75 | with a |large nu|
|00000b70| 6d 62 65 72 20 6f 66 20 | 6e 65 77 20 66 65 61 74 |mber of |new feat|
|00000b80| 75 72 65 73 20 62 75 74 | 20 77 68 69 63 68 20 77 |ures but| which w|
|00000b90| 6f 75 6c 64 20 73 74 69 | 6c 6c 20 72 75 6e 20 6f |ould sti|ll run o|
|00000ba0| 6e 20 63 6f 6d 70 75 74 | 65 72 20 73 79 73 74 65 |n comput|er syste|
|00000bb0| 6d 73 20 77 69 74 68 20 | 76 65 72 79 20 6c 69 74 |ms with |very lit|
|00000bc0| 74 6c 65 20 6d 65 6d 6f | 72 79 2e 20 20 53 6f 66 |tle memo|ry. Sof|
|00000bd0| 74 77 61 72 65 20 64 65 | 76 65 6c 6f 70 65 72 73 |tware de|velopers|
|00000be0| 20 66 6f 75 6e 64 20 74 | 68 61 74 20 74 68 65 79 | found t|hat they|
|00000bf0| 20 63 6f 75 6c 64 6e 27 | 74 20 64 65 6c 69 76 65 | couldn'|t delive|
|00000c00| 72 20 74 68 65 20 70 72 | 6f 67 72 61 6d 73 20 6f |r the pr|ograms o|
|00000c10| 6e 20 74 69 6d 65 2e 20 | 20 54 68 65 20 73 6f 66 |n time. | The sof|
|00000c20| 74 77 61 72 65 20 68 61 | 64 20 73 6f 20 6d 61 6e |tware ha|d so man|
|00000c30| 79 20 66 65 61 74 75 72 | 65 73 20 74 68 61 74 20 |y featur|es that |
|00000c40| 69 74 20 77 61 73 20 63 | 61 6c 6c 65 64 20 22 62 |it was c|alled "b|
|00000c50| 69 67 77 61 72 65 22 20 | 61 6e 64 20 69 74 20 74 |igware" |and it t|
|00000c60| 6f 6f 6b 20 73 6f 20 6c | 6f 6e 67 20 74 6f 20 64 |ook so l|ong to d|
|00000c70| 65 76 65 6c 6f 70 20 74 | 68 61 74 20 69 74 20 77 |evelop t|hat it w|
|00000c80| 61 73 20 6c 61 74 65 72 | 20 6b 6e 6f 77 6e 20 61 |as later| known a|
|00000c90| 73 20 22 6c 61 74 65 77 | 61 72 65 22 2e f9 04 f7 |s "latew|are"....|
|00000ca0| ff 00 15 08 00 f7 f4 f9 | 00 f7 ff 00 15 0a 00 f7 |........|........|
|00000cb0| 0d 01 1a 0d 57 68 61 74 | 20 73 6f 66 74 77 61 72 |....What| softwar|
|00000cc0| 65 20 64 65 76 65 6c 6f | 70 65 72 73 20 77 65 72 |e develo|pers wer|
|00000cd0| 65 20 66 69 6e 64 69 6e | 67 20 77 61 73 20 74 68 |e findin|g was th|
|00000ce0| 61 74 20 61 73 20 74 68 | 65 79 20 74 72 69 65 64 |at as th|ey tried|
|00000cf0| 20 74 6f 20 61 64 64 20 | 6e 65 77 20 66 65 61 74 | to add |new feat|
|00000d00| 75 72 65 73 20 74 68 65 | 79 20 77 6f 75 6c 64 20 |ures the|y would |
|00000d10| 69 6e 74 72 6f 64 75 63 | 65 20 6e 65 77 20 62 75 |introduc|e new bu|
|00000d20| 67 73 2e 20 20 41 6e 64 | 20 74 72 79 69 6e 67 20 |gs. And| trying |
|00000d30| 74 6f 20 66 69 78 20 74 | 68 6f 73 65 20 62 75 67 |to fix t|hose bug|
|00000d40| 73 20 69 6e 74 72 6f 64 | 75 63 65 64 20 61 64 64 |s introd|uced add|
|00000d50| 69 74 69 6f 6e 61 6c 20 | 62 75 67 73 2e 20 20 54 |itional |bugs. T|
|00000d60| 68 65 20 72 65 73 75 6c | 74 20 77 61 73 20 61 20 |he resul|t was a |
|00000d70| 64 72 61 73 74 69 63 20 | 64 65 63 6c 69 6e 65 20 |drastic |decline |
|00000d80| 69 6e 20 73 6f 66 74 77 | 61 72 65 20 70 72 6f 64 |in softw|are prod|
|00000d90| 75 63 74 69 76 69 74 79 | 20 61 73 20 74 68 65 20 |uctivity| as the |
|00000da0| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 61 20 70 72 |the size| of a pr|
|00000db0| 6f 6a 65 63 74 20 67 72 | 65 77 20 28 73 65 65 20 |oject gr|ew (see |
|00000dc0| 46 69 67 75 72 65 20 34 | 2d 31 29 0d 0d 00 39 fc |Figure 4|-1)...9.|
|00000dd0| 00 6c 02 0a 00 6c 02 0e | 02 1c 06 30 f7 ff 00 14 |.l...l..|...0....|
|00000de0| 2e 00 f7 fb 00 00 00 01 | 01 00 01 4f 57 4e 47 72 |........|...OWNGr|
|00000df0| 61 70 68 69 63 2e 39 31 | 30 39 30 32 2e 65 70 73 |aphic.91|0902.eps|
|00000e00| f7 ff 00 15 0a 01 f7 0d | 03 c7 46 69 67 75 72 65 |........|..Figure|
|00000e10| 20 34 2d 31 20 44 72 6f | 70 70 69 6e 67 20 50 72 | 4-1 Dro|pping Pr|
|00000e20| 6f 64 75 63 74 69 76 69 | 74 79 20 61 73 20 50 72 |oductivi|ty as Pr|
|00000e30| 6f 6a 65 63 74 20 47 72 | 6f 77 73 0d 0d fc 00 6c |oject Gr|ows....l|
|00000e40| 02 0a 00 6c 00 0e 02 1c | 06 30 f7 ff 00 15 0a 00 |...l....|.0......|
|00000e50| f7 54 6f 20 73 6f 6c 76 | 65 20 74 68 69 73 20 70 |.To solv|e this p|
|00000e60| 72 6f 62 6c 65 6d 20 77 | 65 20 6d 75 73 74 20 6c |roblem w|e must l|
|00000e70| 6f 6f 6b 20 61 74 20 74 | 68 65 20 77 61 79 73 20 |ook at t|he ways |
|00000e80| 77 65 20 63 72 65 61 74 | 65 20 70 72 6f 67 72 61 |we creat|e progra|
|00000e90| 6d 73 20 61 6e 64 20 69 | 6e 74 65 67 72 61 74 65 |ms and i|ntegrate|
|00000ea0| 20 74 68 65 6d 20 74 6f | 67 65 74 68 65 72 20 74 | them to|gether t|
|00000eb0| 6f 20 63 72 65 61 74 65 | 20 61 20 73 6f 66 74 77 |o create| a softw|
|00000ec0| 61 72 65 20 73 79 73 74 | 65 6d 2e 20 20 57 65 20 |are syst|em. We |
|00000ed0| 6d 75 73 74 20 6e 6f 74 | 20 6c 6f 6f 6b 20 61 74 |must not| look at|
|00000ee0| 20 74 68 65 20 73 75 70 | 65 72 66 69 63 69 61 6c | the sup|erficial|
|00000ef0| 20 66 65 61 74 75 72 65 | 73 20 6f 66 20 73 6f 66 | feature|s of sof|
|00000f00| 74 77 61 72 65 20 70 72 | 6f 64 75 63 74 69 76 69 |tware pr|oductivi|
|00000f10| 74 79 20 74 6f 6f 6c 73 | 20 62 75 74 20 61 74 20 |ty tools| but at |
|00000f20| 74 68 65 20 76 65 72 79 | 20 66 6f 75 6e 64 61 74 |the very| foundat|
|00000f30| 69 6f 6e 73 20 6f 66 20 | 74 68 65 20 77 61 79 20 |ions of |the way |
|00000f40| 77 65 20 63 72 65 61 74 | 65 20 73 6f 66 74 77 61 |we creat|e softwa|
|00000f50| 72 65 2e 0d 0d 52 65 73 | 65 61 72 63 68 65 72 73 |re...Res|earchers|
|00000f60| 20 68 61 76 65 20 62 65 | 65 6e 20 73 74 75 64 79 | have be|en study|
|00000f70| 69 6e 67 20 73 6f 66 74 | 77 61 72 65 20 64 65 73 |ing soft|ware des|
|00000f80| 69 67 6e 20 74 65 63 68 | 6e 69 71 75 65 73 20 66 |ign tech|niques f|
|00000f90| 6f 72 20 6d 61 6e 79 20 | 79 65 61 72 73 2e 20 20 |or many |years. |
|00000fa0| 4d 75 63 68 20 6f 66 20 | 74 68 65 20 70 69 6f 6e |Much of |the pion|
|00000fb0| 65 65 72 69 6e 67 20 72 | 65 73 65 61 72 63 68 20 |eering r|esearch |
|00000fc0| 64 6f 6e 65 20 61 74 20 | 58 65 72 6f 78 20 50 61 |done at |Xerox Pa|
|00000fd0| 6c 6f 20 41 6c 74 6f 20 | 52 65 73 65 61 72 63 68 |lo Alto |Research|
|00000fe0| 20 43 65 6e 74 65 72 20 | 77 69 74 68 20 74 6f 74 | Center |with tot|
|00000ff0| 61 6c 6c 79 20 6e 65 77 | 20 70 72 6f 67 72 61 6d |ally new| program|
|00001000| 6d 69 6e 67 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |ming env|ironment|
|00001010| 73 20 73 75 63 68 20 61 | 73 20 53 6d 61 6c 6c 54 |s such a|s SmallT|
|00001020| 61 6c 6b 20 68 61 73 20 | 73 68 6f 77 6e 20 74 68 |alk has |shown th|
|00001030| 61 74 20 74 68 65 72 65 | 20 61 72 65 20 72 61 64 |at there| are rad|
|00001040| 69 63 61 6c 6c 79 20 64 | 69 66 66 65 72 65 6e 74 |ically d|ifferent|
|00001050| 20 61 70 70 72 6f 61 63 | 68 65 73 20 74 6f 20 63 | approac|hes to c|
|00001060| 72 65 61 74 69 6e 67 20 | 73 6f 66 74 77 61 72 65 |reating |software|
|00001070| 20 74 68 61 74 20 63 68 | 61 6c 6c 65 6e 67 65 20 | that ch|allenge |
|00001080| 74 72 61 64 69 74 69 6f | 6e 61 6c 20 6d 65 74 68 |traditio|nal meth|
|00001090| 6f 64 73 20 63 75 72 72 | 65 6e 74 6c 79 20 62 65 |ods curr|ently be|
|000010a0| 69 6e 67 20 74 61 75 67 | 68 74 2e 20 20 4f 6e 65 |ing taug|ht. One|
|000010b0| 20 66 61 6d 69 6c 79 20 | 6f 66 20 74 65 63 68 6e | family |of techn|
|000010c0| 69 71 75 65 73 20 67 61 | 69 6e 65 64 20 61 20 67 |iques ga|ined a g|
|000010d0| 72 65 61 74 20 64 65 61 | 6c 20 6f 66 20 70 6f 70 |reat dea|l of pop|
|000010e0| 75 6c 61 72 69 74 79 20 | 69 6e 20 74 68 65 20 6d |ularity |in the m|
|000010f0| 69 64 2d 65 69 67 68 74 | 69 65 73 20 61 72 65 20 |id-eight|ies are |
|00001100| 6e 6f 77 20 63 75 72 72 | 65 6e 74 6c 79 20 72 65 |now curr|ently re|
|00001110| 66 65 72 72 65 64 20 74 | 6f 20 61 73 20 74 68 65 |ferred t|o as the|
|00001120| 20 70 72 69 6e 63 69 70 | 61 6c 73 20 6f 66 20 6f | princip|als of o|
|00001130| 62 6a 65 63 74 20 6f 72 | 69 65 6e 74 65 64 20 70 |bject or|iented p|
|00001140| 72 6f 67 72 61 6d 6d 69 | 6e 67 2e 20 20 57 65 20 |rogrammi|ng. We |
|00001150| 77 69 6c 6c 20 69 6e 74 | 72 6f 64 75 63 65 20 74 |will int|roduce t|
|00001160| 68 65 73 65 20 74 65 63 | 68 6e 69 71 75 65 73 20 |hese tec|hniques |
|00001170| 74 6f 20 79 6f 75 20 69 | 6e 20 74 68 69 73 20 61 |to you i|n this a|
|00001180| 6e 64 20 6c 61 74 65 72 | 20 63 68 61 70 74 65 72 |nd later| chapter|
|00001190| 73 2e 20 20 4f 75 72 20 | 66 69 72 73 74 20 74 65 |s. Our |first te|
|000011a0| 63 68 6e 69 71 75 65 73 | 20 77 69 6c 6c 20 63 6f |chniques| will co|
|000011b0| 76 65 72 20 74 68 65 20 | 63 72 65 61 74 69 6f 6e |ver the |creation|
|000011c0| 20 6f 66 20 6e 65 77 20 | 6f 62 6a 65 63 74 73 2e | of new |objects.|
|000011d0| 0d 04 14 0d fc 00 48 02 | 0a 00 48 00 0e 02 1c 06 |......H.|..H.....|
|000011e0| 30 f7 ff 00 15 10 01 f7 | 45 6e 63 61 70 73 75 6c |0.......|Encapsul|
|000011f0| 61 74 69 6f 6e ff 00 15 | 10 00 f7 0d fc 00 6c 02 |ation...|......l.|
|00001200| 0a 00 6c 00 0e 02 1c 06 | 30 f7 0d ff 00 15 0a 00 |..l.....|0.......|
|00001210| f7 45 6e 63 61 70 73 75 | 6c 61 74 69 6f 6e 20 68 |.Encapsu|lation h|
|00001220| 61 73 20 76 61 72 69 6f | 75 73 20 6e 61 6d 65 73 |as vario|us names|
|00001230| 2e 20 20 43 6f 6d 70 75 | 74 65 72 20 73 63 69 65 |. Compu|ter scie|
|00001240| 6e 74 69 73 74 73 20 6f | 66 74 65 6e 20 72 65 66 |ntists o|ften ref|
|00001250| 65 72 20 74 6f 20 69 74 | 20 61 73 20 22 69 6e 66 |er to it| as "inf|
|00001260| 6f 72 6d 61 74 69 6f 6e | 20 68 69 64 69 6e 67 22 |ormation| hiding"|
|00001270| 20 6f 72 20 22 64 61 74 | 61 20 61 62 73 74 72 61 | or "dat|a abstra|
|00001280| 63 74 69 6f 6e 22 2e 20 | 20 20 49 6e 20 67 65 6e |ction". | In gen|
|00001290| 65 72 61 6c 2c 20 74 68 | 65 73 65 20 74 65 72 6d |eral, th|ese term|
|000012a0| 73 20 69 6d 70 6c 79 20 | 67 72 6f 75 70 69 6e 67 |s imply |grouping|
|000012b0| 20 64 61 74 61 20 61 6e | 64 20 74 68 65 20 70 72 | data an|d the pr|
|000012c0| 6f 63 65 64 75 72 65 73 | 20 74 6f 20 61 63 63 65 |ocedures| to acce|
|000012d0| 73 73 20 74 68 61 74 20 | 64 61 74 61 20 74 6f 67 |ss that |data tog|
|000012e0| 65 74 68 65 72 20 69 6e | 20 74 68 65 20 73 61 6d |ether in| the sam|
|000012f0| 65 20 75 6e 69 74 2e 20 | 20 57 65 20 63 61 6c 6c |e unit. | We call|
|00001300| 20 74 68 69 73 20 75 6e | 69 74 20 61 6e 20 6f 62 | this un|it an ob|
|00001310| 6a 65 63 74 2e 20 20 57 | 65 20 61 6c 73 6f 20 73 |ject. W|e also s|
|00001320| 65 74 20 64 6f 77 6e 20 | 73 6f 6d 65 20 72 75 6c |et down |some rul|
|00001330| 65 73 20 61 62 6f 75 74 | 20 68 6f 77 20 79 6f 75 |es about| how you|
|00001340| 20 63 61 6e 20 61 63 63 | 65 73 73 20 74 68 65 20 | can acc|ess the |
|00001350| 64 61 74 61 20 69 6e 20 | 74 68 65 20 6f 62 6a 65 |data in |the obje|
|00001360| 63 74 2e 20 20 4f 6e 65 | 20 72 75 6c 65 20 69 73 |ct. One| rule is|
|00001370| 20 74 68 61 74 20 69 66 | 20 77 65 20 64 65 76 65 | that if| we deve|
|00001380| 6c 6f 70 20 61 6e 64 20 | 6f 62 6a 65 63 74 2c 20 |lop and |object, |
|00001390| 79 6f 75 20 ff 00 15 0a | 01 f7 6f 6e 6c 79 ff 00 |you ....|..only..|
|000013a0| 15 0a 00 f7 20 6c 65 74 | 20 70 65 6f 70 6c 65 20 |.... let| people |
|000013b0| 73 65 65 20 6f 72 20 63 | 68 61 6e 67 65 20 79 6f |see or c|hange yo|
|000013c0| 75 72 20 69 6e 74 65 72 | 6e 61 6c 20 64 61 74 61 |ur inter|nal data|
|000013d0| 20 75 73 69 6e 67 20 74 | 68 65 20 70 72 6f 63 65 | using t|he proce|
|000013e0| 64 75 72 65 73 20 77 65 | 20 70 72 6f 76 69 64 65 |dures we| provide|
|000013f0| 20 77 69 74 68 20 74 68 | 61 74 20 6f 62 6a 65 63 | with th|at objec|
|00001400| 74 2e 20 20 54 68 69 73 | 20 6d 65 61 6e 73 20 74 |t. This| means t|
|00001410| 68 65 20 63 72 65 61 74 | 6f 72 20 6f 66 20 74 68 |he creat|or of th|
|00001420| 65 20 6f 62 6a 65 63 74 | 20 68 61 73 20 74 68 65 |e object| has the|
|00001430| 20 75 6c 74 69 6d 61 74 | 65 20 63 6f 6e 74 72 6f | ultimat|e contro|
|00001440| 6c 20 6f 66 20 68 6f 77 | 20 75 73 65 72 73 20 61 |l of how| users a|
|00001450| 63 63 65 73 73 20 74 68 | 69 73 20 6f 62 6a 65 63 |ccess th|is objec|
|00001460| 74 20 61 6e 64 20 63 68 | 61 6e 67 65 20 74 68 65 |t and ch|ange the|
|00001470| 20 69 6e 74 65 72 6e 61 | 6c 20 73 74 61 74 65 73 | interna|l states|
|00001480| 20 6f 66 20 74 68 65 20 | 6f 62 6a 65 63 74 2e 20 | of the |object. |
|00001490| 20 54 68 65 20 63 72 65 | 61 74 6f 72 20 6f 66 20 | The cre|ator of |
|000014a0| 61 6e 20 6f 62 6a 65 63 | 74 20 69 73 20 72 65 73 |an objec|t is res|
|000014b0| 70 6f 6e 73 69 62 6c 65 | 20 66 6f 72 20 63 72 65 |ponsible| for cre|
|000014c0| 61 74 69 6e 67 20 61 6e | 64 20 74 65 73 74 69 6e |ating an|d testin|
|000014d0| 67 20 61 6c 6c 20 6f 66 | 20 74 68 65 20 77 61 79 |g all of| the way|
|000014e0| 73 20 61 20 75 73 65 72 | 20 77 69 6c 6c 20 72 65 |s a user| will re|
|000014f0| 61 64 20 74 68 65 20 73 | 74 61 74 65 20 6f 66 20 |ad the s|tate of |
|00001500| 6f 6e 20 6f 62 6a 65 63 | 74 20 61 73 20 77 65 6c |on objec|t as wel|
|00001510| 6c 20 61 73 20 63 68 65 | 63 6b 69 6e 67 20 74 68 |l as che|cking th|
|00001520| 61 74 20 69 6e 70 75 74 | 73 20 74 6f 20 63 68 61 |at input|s to cha|
|00001530| 6e 67 65 20 74 68 65 20 | 73 74 61 74 65 20 6f 66 |nge the |state of|
|00001540| 20 61 6e 20 6f 62 6a 65 | 63 74 20 61 72 65 20 76 | an obje|ct are v|
|00001550| 61 6c 69 64 2e 20 20 54 | 68 65 20 63 72 65 61 74 |alid. T|he creat|
|00001560| 6f 72 20 6f 66 20 61 6e | 20 6f 62 6a 65 63 74 20 |or of an| object |
|00001570| 28 72 61 74 68 65 72 20 | 74 68 65 6e 20 74 68 65 |(rather |then the|
|00001580| 20 75 73 65 72 20 6f 66 | 20 61 6e 20 6f 62 6a 65 | user of| an obje|
|00001590| 63 74 29 20 68 61 73 20 | 63 6f 6d 70 6c 65 74 65 |ct) has |complete|
|000015a0| 20 72 65 73 70 6f 6e 73 | 69 62 69 6c 69 74 79 20 | respons|ibility |
|000015b0| 6f 66 20 63 6f 6d 70 6c | 65 74 65 6e 65 73 73 20 |of compl|eteness |
|000015c0| 61 6e 64 20 63 6f 72 72 | 65 63 74 6e 65 73 73 20 |and corr|ectness |
|000015d0| 6f 66 20 61 6c 6c 20 61 | 63 63 65 73 73 20 6d 65 |of all a|ccess me|
|000015e0| 74 68 6f 64 73 2e 0d 00 | 9b 0d 57 68 65 6e 20 77 |thods...|..When w|
|000015f0| 65 20 74 72 79 20 74 6f | 20 63 72 65 61 74 65 20 |e try to| create |
|00001600| 61 20 6d 65 6e 74 61 6c | 20 69 6d 61 67 65 20 6f |a mental| image o|
|00001610| 66 20 74 68 65 20 6f 62 | 6a 65 63 74 73 2c 20 77 |f the ob|jects, w|
|00001620| 65 20 6d 69 67 68 74 20 | 66 69 6e 64 20 69 74 20 |e might |find it |
|00001630| 68 65 6c 70 66 75 6c 20 | 74 6f 20 69 6d 61 67 69 |helpful |to imagi|
|00001640| 6e 65 20 61 20 62 6f 78 | 20 77 69 74 68 20 61 20 |ne a box| with a |
|00001650| 74 68 69 63 6b 20 62 72 | 69 63 6b 20 77 61 6c 6c |thick br|ick wall|
|00001660| 20 61 72 6f 75 6e 64 20 | 69 74 20 61 73 20 69 6e | around |it as in|
|00001670| 20 46 69 67 75 72 65 20 | 34 2d 32 2e ff 00 15 0c | Figure |4-2.....|
|00001680| 00 f7 0d 0d 00 3a fc 00 | 6c 02 0a 00 6c 02 0e 02 |.....:..|l...l...|
|00001690| 1c 06 30 f7 ff 00 15 0a | 00 f7 fb 00 00 00 01 00 |..0.....|........|
|000016a0| f0 0e 01 36 57 4e 47 72 | 61 70 68 69 63 30 39 36 |...6WNGr|aphic096|
|000016b0| 39 38 34 2e 65 70 73 00 | f7 ff 00 15 0c 00 f7 0d |984.eps.|........|
|000016c0| 03 20 0d ff 00 15 0a 01 | f7 46 69 67 75 72 65 20 |. ......|.Figure |
|000016d0| 34 2d 32 3a 20 41 20 73 | 75 67 67 65 73 74 65 64 |4-2: A s|uggested|
|000016e0| 20 6d 65 6e 74 61 6c 20 | 69 6d 61 67 65 20 6f 66 | mental |image of|
|000016f0| 20 61 6e 20 6f 62 6a 65 | 63 74 2e ff 00 15 0c 00 | an obje|ct......|
|00001700| f7 0d fc 00 6c 02 0a 00 | 6c 00 0e 02 1c 06 30 f7 |....l...|l.....0.|
|00001710| 0d ff 00 15 0a 00 f7 49 | 6e 73 69 64 65 20 74 68 |.......I|nside th|
|00001720| 65 20 62 6f 78 20 77 65 | 20 68 61 76 65 20 74 68 |e box we| have th|
|00001730| 65 20 64 61 74 61 20 73 | 74 72 75 63 74 75 72 65 |e data s|tructure|
|00001740| 73 20 73 75 63 68 20 61 | 73 20 69 6e 74 65 67 65 |s such a|s intege|
|00001750| 72 73 2c 20 66 6c 6f 61 | 74 69 6e 67 20 70 6f 69 |rs, floa|ting poi|
|00001760| 6e 74 20 6e 75 6d 62 65 | 72 73 2c 20 73 74 72 69 |nt numbe|rs, stri|
|00001770| 6e 67 73 2c 20 61 6e 64 | 20 6f 74 68 65 72 20 6d |ngs, and| other m|
|00001780| 6f 72 65 20 63 6f 6d 70 | 6c 69 63 61 74 65 64 20 |ore comp|licated |
|00001790| 73 74 72 75 63 74 75 72 | 65 73 20 73 75 63 68 20 |structur|es such |
|000017a0| 61 73 20 6c 69 6e 6b 65 | 64 20 6c 69 73 74 73 20 |as linke|d lists |
|000017b0| 6f 72 20 64 69 72 65 63 | 74 65 64 20 67 72 61 70 |or direc|ted grap|
|000017c0| 68 73 2e 20 20 57 65 20 | 63 61 6c 6c 20 74 68 65 |hs. We |call the|
|000017d0| 73 65 20 74 68 65 20 ff | 00 15 0a 01 f7 69 6e 73 |se the .|.....ins|
|000017e0| 74 61 6e 63 65 20 76 61 | 72 69 61 62 6c 65 73 ff |tance va|riables.|
|000017f0| 00 15 0a 00 f7 2e 20 20 | 54 68 65 79 20 68 6f 6c |...... |They hol|
|00001800| 64 20 74 68 65 20 73 74 | 61 74 65 20 6f 66 20 74 |d the st|ate of t|
|00001810| 68 65 20 6f 62 6a 65 63 | 74 2e 20 20 57 65 20 75 |he objec|t. We u|
|00001820| 73 65 20 74 68 65 20 77 | 6f 72 64 20 69 6e 73 74 |se the w|ord inst|
|00001830| 61 6e 63 65 20 62 65 63 | 61 75 73 65 20 74 68 65 |ance bec|ause the|
|00001840| 72 65 20 69 73 20 61 20 | 64 69 66 66 65 72 65 6e |re is a |differen|
|00001850| 74 20 67 72 6f 75 70 20 | 6f 66 20 74 68 65 73 65 |t group |of these|
|00001860| 20 76 61 72 69 61 62 6c | 65 73 20 61 73 73 6f 63 | variabl|es assoc|
|00001870| 69 61 74 65 64 20 77 69 | 74 68 20 65 61 63 68 20 |iated wi|th each |
|00001880| 69 6e 73 74 61 6e 63 65 | 20 6f 66 20 74 68 65 20 |instance| of the |
|00001890| 6f 62 6a 65 63 74 2e 20 | 20 54 68 65 20 6f 6e 6c |object. | The onl|
|000018a0| 79 20 77 61 79 20 74 6f | 20 72 65 61 64 20 6f 72 |y way to| read or|
|000018b0| 20 77 72 69 74 65 20 74 | 68 65 20 76 61 6c 75 65 | write t|he value|
|000018c0| 73 20 6f 66 20 74 68 65 | 73 65 20 76 61 72 69 61 |s of the|se varia|
|000018d0| 62 6c 65 73 20 69 73 20 | 74 6f 20 75 73 65 20 6f |bles is |to use o|
|000018e0| 6e 65 20 6f 66 20 74 68 | 65 20 ff 00 15 0a 01 f7 |ne of th|e ......|
|000018f0| 61 63 63 65 73 73 20 6d | 65 74 68 6f 64 73 ff 00 |access m|ethods..|
|00001900| 15 0a 00 f7 20 70 72 6f | 76 69 64 65 64 20 77 69 |.... pro|vided wi|
|00001910| 74 68 20 65 61 63 68 20 | 6f 62 6a 65 63 74 2e 20 |th each |object. |
|00001920| 20 57 65 20 6f 66 74 65 | 6e 20 6a 75 73 74 20 61 | We ofte|n just a|
|00001930| 62 62 72 65 76 69 61 74 | 65 20 74 68 69 73 20 62 |bbreviat|e this b|
|00001940| 79 20 6a 75 73 74 20 75 | 73 69 6e 67 20 74 68 65 |y just u|sing the|
|00001950| 20 77 6f 72 64 20 22 6d | 65 74 68 6f 64 22 20 74 | word "m|ethod" t|
|00001960| 6f 20 72 65 66 65 72 20 | 74 6f 20 74 68 65 20 77 |o refer |to the w|
|00001970| 61 79 20 61 20 70 72 6f | 67 72 61 6d 20 67 65 74 |ay a pro|gram get|
|00001980| 73 20 61 63 63 65 73 73 | 20 74 6f 20 74 68 65 20 |s access| to the |
|00001990| 73 74 72 75 63 74 75 72 | 65 73 20 69 6e 73 69 64 |structur|es insid|
|000019a0| 65 20 61 6e 20 6f 62 6a | 65 63 74 2e 0d 0d fc 00 |e an obj|ect.....|
|000019b0| 48 02 0a 00 48 00 0e 02 | 1c 06 30 f7 ff 00 15 10 |H...H...|..0.....|
|000019c0| 01 f7 42 65 6e 65 66 69 | 74 73 20 6f 66 20 45 6e |..Benefi|ts of En|
|000019d0| 63 61 70 73 75 6c 61 74 | 69 6f 6e ff 00 15 0a 01 |capsulat|ion.....|
|000019e0| f7 0d 03 45 fc 00 6c 02 | 0a 00 6c 00 0e 02 1c 06 |...E..l.|..l.....|
|000019f0| 30 f7 0d ff 00 15 0a 00 | f7 4f 6e 63 65 20 77 65 |0.......|.Once we|
|00001a00| 20 73 74 61 72 74 20 65 | 6e 63 61 70 73 75 6c 61 | start e|ncapsula|
|00001a10| 74 69 6e 67 20 79 6f 75 | 72 20 64 61 74 61 20 79 |ting you|r data y|
|00001a20| 6f 75 20 77 69 6c 6c 20 | 66 69 6e 64 20 74 68 61 |ou will |find tha|
|00001a30| 74 20 79 6f 75 20 63 61 | 6e 20 71 75 69 63 6b 6c |t you ca|n quickl|
|00001a40| 79 20 63 6f 6e 74 72 6f | 6c 20 74 68 65 20 64 61 |y contro|l the da|
|00001a50| 74 61 20 74 79 70 65 73 | 20 74 68 61 74 20 61 72 |ta types| that ar|
|00001a60| 65 20 70 61 73 73 65 64 | 20 74 6f 20 79 6f 75 72 |e passed| to your|
|00001a70| 20 6f 62 6a 65 63 74 73 | 2e 20 20 53 69 6e 63 65 | objects|. Since|
|00001a80| 20 74 68 65 20 4e 65 78 | 74 53 74 65 70 20 4f 62 | the Nex|tStep Ob|
|00001a90| 6a 65 63 74 69 76 65 20 | 43 20 63 6f 6d 70 69 6c |jective |C compil|
|00001aa0| 65 72 20 68 61 73 20 74 | 79 70 65 20 63 68 65 63 |er has t|ype chec|
|00001ab0| 6b 69 6e 67 20 62 75 69 | 6c 74 20 69 6e 74 6f 20 |king bui|lt into |
|00001ac0| 69 74 73 20 6d 65 73 73 | 61 67 69 6e 67 20 79 6f |its mess|aging yo|
|00001ad0| 75 20 77 69 6c 6c 20 61 | 6c 77 61 79 73 20 62 65 |u will a|lways be|
|00001ae0| 20 61 62 6c 65 20 74 6f | 20 63 61 74 63 68 20 64 | able to| catch d|
|00001af0| 61 74 61 20 74 79 70 65 | 20 6d 69 73 6d 61 74 63 |ata type| mismatc|
|00001b00| 68 65 73 20 61 74 20 65 | 61 72 6c 79 20 69 6e 20 |hes at e|arly in |
|00001b10| 74 68 65 20 64 65 73 69 | 67 6e 20 70 72 6f 63 65 |the desi|gn proce|
|00001b20| 73 73 20 77 68 65 6e 20 | 69 74 20 69 73 20 6d 75 |ss when |it is mu|
|00001b30| 63 68 20 65 61 73 69 65 | 72 20 74 6f 20 69 73 6f |ch easie|r to iso|
|00001b40| 6c 61 74 65 2e 20 20 54 | 68 69 73 20 77 69 6c 6c |late. T|his will|
|00001b50| 20 64 72 61 6d 61 74 69 | 63 61 6c 6c 79 20 63 75 | dramati|cally cu|
|00001b60| 74 20 64 6f 77 6e 20 74 | 69 6d 65 20 73 70 65 6e |t down t|ime spen|
|00001b70| 74 20 77 69 74 68 20 74 | 68 65 20 64 65 62 75 67 |t with t|he debug|
|00001b80| 67 65 72 20 61 6e 64 20 | 67 72 65 61 74 6c 79 20 |ger and |greatly |
|00001b90| 65 6e 68 61 6e 63 65 20 | 74 68 65 20 70 72 6f 67 |enhance |the prog|
|00001ba0| 72 61 6d 73 20 66 69 6e | 61 6c 20 72 65 6c 69 61 |rams fin|al relia|
|00001bb0| 62 69 6c 69 74 79 2e 0d | 0d 4f 6e 63 65 20 77 65 |bility..|.Once we|
|00001bc0| 20 64 65 66 69 6e 65 20 | 74 68 65 20 73 65 74 20 | define |the set |
|00001bd0| 6f 66 20 6d 65 73 73 61 | 67 65 73 20 74 68 61 74 |of messa|ges that|
|00001be0| 20 61 6e 20 6f 62 6a 65 | 63 74 20 63 61 6e 20 72 | an obje|ct can r|
|00001bf0| 65 63 65 69 76 65 20 77 | 65 20 61 72 65 20 74 68 |eceive w|e are th|
|00001c00| 65 6e 20 66 69 78 69 6e | 67 20 74 68 65 20 69 6e |en fixin|g the in|
|00001c10| 74 65 72 66 61 63 65 20 | 74 6f 20 74 68 61 74 20 |terface |to that |
|00001c20| 6f 62 6a 65 63 74 2e 20 | 20 49 66 2c 20 61 74 20 |object. | If, at |
|00001c30| 61 20 6c 61 74 65 72 20 | 74 69 6d 65 2c 20 79 6f |a later |time, yo|
|00001c40| 75 20 66 69 6e 64 20 61 | 6e 6f 74 68 65 72 20 6d |u find a|nother m|
|00001c50| 6f 72 65 20 65 66 66 69 | 63 69 65 6e 74 20 64 61 |ore effi|cient da|
|00001c60| 74 61 20 73 74 72 75 63 | 74 75 72 65 20 77 65 20 |ta struc|ture we |
|00001c70| 77 6f 75 6c 64 20 6c 69 | 6b 65 20 74 6f 20 75 73 |would li|ke to us|
|00001c80| 65 20 69 6e 73 69 64 65 | 20 74 68 65 20 6f 62 6a |e inside| the obj|
|00001c90| 65 63 74 20 77 65 20 63 | 61 6e 20 63 68 61 6e 67 |ect we c|an chang|
|00001ca0| 65 20 69 74 20 69 6e 74 | 65 72 6e 61 6c 6c 79 20 |e it int|ernally |
|00001cb0| 61 6e 64 20 6e 6f 74 20 | 65 66 66 65 63 74 20 74 |and not |effect t|
|00001cc0| 68 65 20 69 6e 74 65 72 | 66 61 63 65 2e 20 20 54 |he inter|face. T|
|00001cd0| 68 69 73 20 6d 65 61 6e | 73 20 74 68 61 74 20 77 |his mean|s that w|
|00001ce0| 65 20 63 61 6e 20 6d 61 | 6b 65 20 75 70 64 61 74 |e can ma|ke updat|
|00001cf0| 65 73 20 77 69 74 68 6f | 75 74 20 61 66 66 65 63 |es witho|ut affec|
|00001d00| 74 69 6e 67 20 74 68 65 | 20 6f 74 68 65 72 20 63 |ting the| other c|
|00001d10| 6f 6d 70 6f 6e 65 6e 74 | 73 20 6f 66 20 6f 75 72 |omponent|s of our|
|00001d20| 20 73 79 73 74 65 6d 2e | 0d 03 95 0d 41 66 74 65 | system.|....Afte|
|00001d30| 72 20 77 65 20 68 61 76 | 65 20 61 6e 20 6f 62 6a |r we hav|e an obj|
|00001d40| 65 63 74 20 74 68 61 74 | 20 70 65 72 66 6f 72 6d |ect that| perform|
|00001d50| 73 20 73 6f 6d 65 20 73 | 70 65 63 69 66 69 63 20 |s some s|pecific |
|00001d60| 66 75 6e 63 74 69 6f 6e | 2c 20 77 65 20 63 61 6e |function|, we can|
|00001d70| 20 74 68 65 6e 20 63 72 | 65 61 74 65 20 61 20 73 | then cr|eate a s|
|00001d80| 79 6d 62 6f 6c 69 63 20 | 61 62 73 74 72 61 63 74 |ymbolic |abstract|
|00001d90| 69 6f 6e 20 6f 66 20 74 | 68 61 74 20 6f 62 6a 65 |ion of t|hat obje|
|00001da0| 63 74 20 75 73 69 6e 67 | 20 61 20 22 76 69 65 77 |ct using| a "view|
|00001db0| 22 20 6f 66 20 69 74 20 | 6f 6e 20 74 68 65 20 73 |" of it |on the s|
|00001dc0| 63 72 65 65 6e 2e 20 20 | 54 68 65 20 63 6f 6e 6e |creen. |The conn|
|00001dd0| 65 63 74 69 6f 6e 73 20 | 74 6f 20 74 68 65 20 6f |ections |to the o|
|00001de0| 62 6a 65 63 74 20 63 61 | 6e 20 74 68 65 6e 20 62 |bject ca|n then b|
|00001df0| 65 20 64 6f 6e 65 20 77 | 69 74 68 20 4e 65 78 74 |e done w|ith Next|
|00001e00| 53 74 65 70 27 73 20 63 | 6f 6e 6e 65 63 74 69 6f |Step's c|onnectio|
|00001e10| 6e 20 62 61 73 65 64 20 | 70 72 6f 67 72 61 6d 6d |n based |programm|
|00001e20| 69 6e 67 20 74 6f 6f 6c | 73 2e 0d 0d fc 00 48 02 |ing tool|s.....H.|
|00001e30| 0a 00 48 00 0e 02 1c 06 | 30 f7 ff 00 15 12 01 f7 |..H.....|0.......|
|00001e40| 56 69 65 77 73 20 6f 66 | 20 53 75 62 72 6f 75 74 |Views of| Subrout|
|00001e50| 69 6e 65 20 4c 69 62 72 | 61 72 69 65 73 0d fc 00 |ine Libr|aries...|
|00001e60| 6c 02 0a 00 6c 00 0e 02 | 1c 06 30 f7 ff 00 15 0a |l...l...|..0.....|
|00001e70| 01 f7 0d ff 00 15 0a 00 | f7 42 79 20 63 72 65 61 |........|.By crea|
|00001e80| 74 69 6e 67 20 74 68 65 | 73 65 20 76 69 65 77 73 |ting the|se views|
|00001e90| 2c 20 61 20 75 73 65 72 | 20 63 61 6e 20 6e 6f 77 |, a user| can now|
|00001ea0| 20 67 72 61 70 68 69 63 | 61 6c 6c 79 20 6d 61 6e | graphic|ally man|
|00001eb0| 69 70 75 6c 61 74 65 20 | 74 68 65 20 6f 62 6a 65 |ipulate |the obje|
|00001ec0| 63 74 20 61 6e 64 20 69 | 6e 74 65 67 72 61 74 65 |ct and i|ntegrate|
|00001ed0| 20 69 74 20 77 69 74 68 | 20 6f 74 68 65 72 20 6f | it with| other o|
|00001ee0| 62 6a 65 63 74 73 2e 20 | 20 57 68 65 6e 20 75 73 |bjects. | When us|
|00001ef0| 65 72 73 20 6d 61 6b 65 | 20 61 20 63 6f 6e 6e 65 |ers make| a conne|
|00001f00| 63 74 69 6f 6e 20 74 6f | 20 6f 6e 65 20 6f 66 20 |ction to| one of |
|00001f10| 6f 75 72 20 6f 62 6a 65 | 63 74 73 2c 20 4e 65 78 |our obje|cts, Nex|
|00001f20| 74 53 74 65 70 20 77 69 | 6c 6c 20 61 73 6b 20 74 |tStep wi|ll ask t|
|00001f30| 68 65 6d 20 77 68 69 63 | 68 20 6f 66 20 74 68 65 |hem whic|h of the|
|00001f40| 20 61 63 63 65 73 73 20 | 6d 65 74 68 6f 64 73 20 | access |methods |
|00001f50| 74 68 65 79 20 77 6f 75 | 6c 64 20 6c 69 6b 65 20 |they wou|ld like |
|00001f60| 74 6f 20 75 73 65 2e 20 | 20 54 68 69 73 20 6d 65 |to use. | This me|
|00001f70| 61 6e 73 20 74 68 61 74 | 20 6e 6f 6e 2d 70 72 6f |ans that| non-pro|
|00001f80| 67 72 61 6d 6d 65 72 73 | 20 63 61 6e 20 73 74 61 |grammers| can sta|
|00001f90| 72 74 20 75 73 69 6e 67 | 20 74 6f 6f 6c 73 20 74 |rt using| tools t|
|00001fa0| 68 61 74 20 77 65 72 65 | 20 70 72 65 76 69 6f 75 |hat were| previou|
|00001fb0| 73 6c 79 20 6f 6e 6c 79 | 20 61 63 63 65 73 73 69 |sly only| accessi|
|00001fc0| 62 6c 65 20 74 6f 20 61 | 20 76 65 72 79 20 73 6d |ble to a| very sm|
|00001fd0| 61 6c 6c 20 67 72 6f 75 | 70 20 6f 66 20 65 78 70 |all grou|p of exp|
|00001fe0| 65 72 69 65 6e 63 65 64 | 20 70 65 6f 70 6c 65 2e |erienced| people.|
|00001ff0| 20 20 41 6e 64 20 73 69 | 6e 63 65 20 69 74 20 69 | And si|nce it i|
|00002000| 73 20 75 70 20 74 6f 20 | 74 68 65 20 63 72 65 61 |s up to |the crea|
|00002010| 74 6f 72 73 20 6f 66 20 | 74 68 65 20 6f 62 6a 65 |tors of |the obje|
|00002020| 63 74 73 20 74 6f 20 76 | 61 6c 69 64 61 74 65 20 |cts to v|alidate |
|00002030| 74 68 65 20 63 6f 72 72 | 65 63 74 6e 65 73 73 20 |the corr|ectness |
|00002040| 6f 66 20 74 68 65 20 61 | 63 63 65 73 73 20 6d 65 |of the a|ccess me|
|00002050| 74 68 6f 64 73 2c 20 61 | 20 6d 75 63 68 20 6c 61 |thods, a| much la|
|00002060| 72 67 65 72 20 67 72 6f | 75 70 20 6f 66 20 70 65 |rger gro|up of pe|
|00002070| 6f 70 6c 65 20 77 69 6c | 6c 20 62 65 20 61 62 6c |ople wil|l be abl|
|00002080| 65 20 74 6f 20 75 73 65 | 20 74 68 65 20 6f 62 6a |e to use| the obj|
|00002090| 65 63 74 73 20 77 69 74 | 68 6f 75 74 20 74 68 65 |ects wit|hout the|
|000020a0| 20 74 72 61 64 69 74 69 | 6f 6e 61 6c 20 64 65 62 | traditi|onal deb|
|000020b0| 75 67 67 69 6e 67 20 65 | 66 66 6f 72 74 73 2e 0d |ugging e|fforts..|
|000020c0| 03 bd 0d 42 65 66 6f 72 | 65 20 6f 62 6a 65 63 74 |...Befor|e object|
|000020d0| 20 62 61 73 65 64 20 63 | 6f 6d 70 75 74 69 6e 67 | based c|omputing|
|000020e0| 20 77 65 20 68 61 64 20 | 74 6f 20 75 73 65 20 61 | we had |to use a|
|000020f0| 20 6d 61 6e 75 61 6c 20 | 74 6f 20 66 69 6e 64 20 | manual |to find |
|00002100| 6f 75 74 20 61 6c 6c 20 | 74 68 65 20 61 72 67 75 |out all |the argu|
|00002110| 6d 65 6e 74 73 20 74 6f | 20 61 20 73 75 62 72 6f |ments to| a subro|
|00002120| 75 74 69 6e 65 2c 20 64 | 65 63 6c 61 72 65 20 61 |utine, d|eclare a|
|00002130| 6c 6c 20 74 68 65 20 61 | 72 67 75 6d 65 6e 74 73 |ll the a|rguments|
|00002140| 20 77 69 74 68 20 74 68 | 65 20 63 6f 72 72 65 63 | with th|e correc|
|00002150| 74 20 64 61 74 61 20 74 | 79 70 65 73 2c 20 70 61 |t data t|ypes, pa|
|00002160| 73 73 20 74 68 65 73 65 | 20 69 6e 20 74 68 65 20 |ss these| in the |
|00002170| 63 6f 72 72 65 63 74 20 | 6f 72 64 65 72 20 74 6f |correct |order to|
|00002180| 20 73 75 62 72 6f 75 74 | 69 6e 65 73 20 61 6e 64 | subrout|ines and|
|00002190| 20 74 68 65 6e 20 69 66 | 20 79 6f 75 20 67 65 74 | then if| you get|
|000021a0| 20 61 6e 79 20 6f 66 20 | 74 68 65 6d 20 77 72 6f | any of |them wro|
|000021b0| 6e 67 2c 20 73 74 61 72 | 74 20 61 20 6c 65 61 72 |ng, star|t a lear|
|000021c0| 6e 69 6e 67 20 68 6f 77 | 20 74 6f 20 75 73 65 20 |ning how| to use |
|000021d0| 74 68 65 20 64 65 62 75 | 67 67 65 72 2e 20 20 4e |the debu|gger. N|
|000021e0| 6f 77 20 77 65 20 77 69 | 6c 6c 20 6a 75 73 74 20 |ow we wi|ll just |
|000021f0| 70 6f 69 6e 74 20 74 6f | 20 61 20 73 6f 75 72 63 |point to| a sourc|
|00002200| 65 20 6f 62 6a 65 63 74 | 2c 20 64 72 61 67 20 61 |e object|, drag a|
|00002210| 20 6c 69 6e 65 20 74 6f | 20 61 20 64 65 73 74 69 | line to| a desti|
|00002220| 6e 61 74 69 6f 6e 20 6f | 62 6a 65 63 74 20 61 6e |nation o|bject an|
|00002230| 64 20 63 6c 69 63 6b 20 | 6f 6e 20 74 68 65 20 6d |d click |on the m|
|00002240| 65 73 73 61 67 65 20 74 | 6f 20 62 65 20 73 65 6e |essage t|o be sen|
|00002250| 74 2e 20 20 43 6f 72 72 | 65 63 74 6e 65 73 73 20 |t. Corr|ectness |
|00002260| 69 73 20 65 6e 66 6f 72 | 63 65 64 20 62 79 20 74 |is enfor|ced by t|
|00002270| 68 65 20 75 73 65 72 20 | 69 6e 74 65 72 66 61 63 |he user |interfac|
|00002280| 65 2e 0d 0d fc 00 48 02 | 0a 00 48 00 0e 02 1c 06 |e.....H.|..H.....|
|00002290| 30 f7 ff 00 15 12 01 f7 | 49 6e 68 65 72 69 74 61 |0.......|Inherita|
|000022a0| 6e 63 65 0d f9 00 f7 ff | 00 15 0a 01 f7 fc 00 6c |nce.....|.......l|
|000022b0| 02 0a 00 6c 00 0e 02 1c | 06 30 f7 0d ff 00 15 0a |...l....|.0......|
|000022c0| 00 f7 42 65 66 6f 72 65 | 20 77 65 20 64 69 73 63 |..Before| we disc|
|000022d0| 75 73 73 20 69 6e 68 65 | 72 69 74 61 6e 63 65 2c |uss inhe|ritance,|
|000022e0| 20 49 20 77 61 6e 74 20 | 74 6f 20 6d 61 6b 65 20 | I want |to make |
|000022f0| 74 68 65 20 64 69 73 74 | 69 6e 63 74 69 6f 6e 20 |the dist|inction |
|00002300| 62 65 74 77 65 65 6e 20 | 61 20 69 6e 73 74 61 6e |between |a instan|
|00002310| 63 65 20 6f 66 20 61 6e | 20 6f 62 6a 65 63 74 20 |ce of an| object |
|00002320| 61 6e 64 20 61 20 ff 00 | 15 0a 01 f7 63 6c 61 73 |and a ..|....clas|
|00002330| 73 ff 00 15 0a 00 f7 20 | 6f 66 20 6f 62 6a 65 63 |s...... |of objec|
|00002340| 74 73 2e 20 20 54 68 65 | 20 63 68 61 72 61 63 74 |ts. The| charact|
|00002350| 65 72 69 73 74 69 63 73 | 20 6f 66 20 63 6c 61 73 |eristics| of clas|
|00002360| 73 20 6f 66 20 6f 62 6a | 65 63 74 73 2c 20 6c 69 |s of obj|ects, li|
|00002370| 6b 65 20 61 20 46 6f 72 | 64 20 54 72 75 63 6b 2c |ke a For|d Truck,|
|00002380| 20 69 73 20 64 65 74 65 | 72 6d 69 6e 65 64 20 62 | is dete|rmined b|
|00002390| 79 20 74 68 65 20 66 61 | 63 74 6f 72 79 20 77 68 |y the fa|ctory wh|
|000023a0| 69 63 68 20 63 72 65 61 | 74 65 73 20 74 68 65 20 |ich crea|tes the |
|000023b0| 74 72 75 63 6b 73 2e 20 | 20 49 66 20 49 20 68 61 |trucks. | If I ha|
|000023c0| 64 20 61 20 46 6f 72 64 | 20 54 72 75 63 6b 2c 20 |d a Ford| Truck, |
|000023d0| 49 20 77 6f 75 6c 64 20 | 68 61 76 65 20 61 6e 20 |I would |have an |
|000023e0| 69 6e 73 74 61 6e 63 65 | 20 6f 66 20 74 68 65 20 |instance| of the |
|000023f0| 74 72 75 63 6b 2e 20 20 | 53 69 6d 69 6c 61 72 6c |truck. |Similarl|
|00002400| 79 20 77 65 20 68 61 76 | 65 20 63 6c 61 73 73 20 |y we hav|e class |
|00002410| 6f 66 20 6f 62 6a 65 63 | 74 73 20 77 68 69 63 68 |of objec|ts which|
|00002420| 20 63 72 65 61 74 65 20 | 6e 65 77 20 69 6e 73 74 | create |new inst|
|00002430| 61 6e 63 65 73 20 6f 66 | 20 6f 62 6a 65 63 74 73 |ances of| objects|
|00002440| 2e 20 20 41 6e 64 20 74 | 68 65 73 65 20 61 72 65 |. And t|hese are|
|00002450| 20 6e 61 74 75 72 61 6c | 6c 79 20 63 61 6c 6c 65 | natural|ly calle|
|00002460| 64 20 ff 00 15 0a 01 f7 | 66 61 63 74 6f 72 79 20 |d ......|factory |
|00002470| 6f 62 6a 65 63 74 73 ff | 00 15 0a 00 f7 2e 0d 01 |objects.|........|
|00002480| 71 0d 4f 75 72 20 73 65 | 63 6f 6e 64 20 74 65 63 |q.Our se|cond tec|
|00002490| 68 6e 69 71 75 65 20 69 | 73 20 49 6e 68 65 72 69 |hnique i|s Inheri|
|000024a0| 74 61 6e 63 65 2e 20 20 | 57 68 65 6e 65 76 65 72 |tance. |Whenever|
|000024b0| 20 77 65 20 63 72 65 61 | 74 65 20 61 20 6e 65 77 | we crea|te a new|
|000024c0| 20 ff 00 15 0a 01 f7 63 | 6c 61 73 73 ff 00 15 0a | ......c|lass....|
|000024d0| 00 f7 20 6f 66 20 6f 62 | 6a 65 63 74 73 2c 20 77 |.. of ob|jects, w|
|000024e0| 65 20 61 6c 77 61 79 73 | 20 63 72 65 61 74 65 20 |e always| create |
|000024f0| 69 74 20 72 65 6c 61 74 | 69 76 65 20 74 6f 20 6f |it relat|ive to o|
|00002500| 74 68 65 72 20 6f 62 6a | 65 63 74 73 20 63 6c 61 |ther obj|ects cla|
|00002510| 73 73 65 73 2e 20 54 68 | 65 73 65 20 63 6c 61 73 |sses. Th|ese clas|
|00002520| 73 65 73 20 74 68 65 6e | 20 66 69 74 20 74 6f 67 |ses then| fit tog|
|00002530| 65 74 68 65 72 20 69 6e | 74 6f 20 61 20 22 74 72 |ether in|to a "tr|
|00002540| 65 65 22 20 6f 66 20 6f | 62 6a 65 63 74 20 63 6c |ee" of o|bject cl|
|00002550| 61 73 73 65 73 2e 0d 0d | fc 00 48 02 0a 00 48 00 |asses...|..H...H.|
|00002560| 0e 02 1c 06 30 f7 ff 00 | 15 12 01 f7 53 61 6d 70 |....0...|....Samp|
|00002570| 6c 65 20 49 6e 68 65 72 | 69 74 61 6e 63 65 20 54 |le Inher|itance T|
|00002580| 72 65 65 0d f9 00 f7 ff | 00 15 0c 00 f7 fc 00 6c |ree.....|.......l|
|00002590| 02 0a 00 6c 00 0e 02 1c | 06 30 f7 0d ff 00 15 0a |...l....|.0......|
|000025a0| 00 f7 54 68 65 20 73 74 | 72 75 63 74 75 72 65 20 |..The st|ructure |
|000025b0| 69 73 20 76 65 72 79 20 | 73 69 6d 69 6c 61 72 20 |is very |similar |
|000025c0| 74 6f 20 61 6e 20 65 76 | 6f 6c 75 74 69 6f 6e 61 |to an ev|olutiona|
|000025d0| 72 79 20 74 72 65 65 20 | 28 73 65 65 20 66 69 67 |ry tree |(see fig|
|000025e0| 75 72 65 20 34 2d 33 29 | 2e 0d 0d ff 00 15 0c 00 |ure 4-3)|........|
|000025f0| f7 0d 00 39 fc 00 6c 02 | 0a 00 6c 02 0e 02 1c 06 |...9..l.|..l.....|
|00002600| 30 f7 ff 00 14 2e 01 f7 | fb 00 00 00 01 00 e8 01 |0.......|........|
|00002610| 81 57 4e 47 72 61 70 68 | 69 63 39 32 36 30 36 35 |.WNGraph|ic926065|
|00002620| 2e 65 70 73 00 f7 ff 00 | 15 0c 00 f7 0d 03 86 0d |.eps....|........|
|00002630| ff 00 15 0a 01 f7 46 69 | 67 75 72 65 20 34 2d 33 |......Fi|gure 4-3|
|00002640| 3a 20 41 20 73 61 6d 70 | 6c 65 20 69 6e 68 65 72 |: A samp|le inher|
|00002650| 69 74 61 6e 63 65 20 74 | 72 65 65 ff 00 15 0c 00 |itance t|ree.....|
|00002660| f7 0d fc 00 6c 02 0a 00 | 6c 00 0e 02 1c 06 30 f7 |....l...|l.....0.|
|00002670| 0d 0d ff 00 15 0a 00 f7 | 54 68 65 20 20 6d 6f 73 |........|The mos|
|00002680| 74 20 67 65 6e 65 72 61 | 6c 20 63 6c 61 73 73 20 |t genera|l class |
|00002690| 69 73 20 61 74 20 74 68 | 65 20 74 6f 70 2c 20 61 |is at th|e top, a|
|000026a0| 6e 64 20 65 61 63 68 20 | 63 6c 61 73 73 20 74 68 |nd each |class th|
|000026b0| 61 74 20 68 61 73 20 61 | 20 67 72 6f 75 70 20 6f |at has a| group o|
|000026c0| 66 20 63 6f 6d 6d 6f 6e | 20 63 68 61 72 61 63 74 |f common| charact|
|000026d0| 65 72 69 73 74 69 63 73 | 20 77 6f 75 6c 64 20 62 |eristics| would b|
|000026e0| 65 20 61 20 6c 6f 77 65 | 72 20 63 6c 61 73 73 2e |e a lowe|r class.|
|000026f0| 20 20 41 6e 20 69 6d 70 | 6f 72 74 61 6e 74 20 70 | An imp|ortant p|
|00002700| 6f 69 6e 74 20 68 65 72 | 65 20 69 73 20 74 68 61 |oint her|e is tha|
|00002710| 74 20 79 6f 75 20 63 61 | 6e 20 63 72 65 61 74 65 |t you ca|n create|
|00002720| 20 61 6e 20 69 6e 73 74 | 61 6e 63 65 20 66 72 6f | an inst|ance fro|
|00002730| 6d 20 61 6e 79 20 6c 65 | 76 65 6c 20 69 6e 20 74 |m any le|vel in t|
|00002740| 68 65 20 74 72 65 65 2e | 20 20 41 6e 64 20 77 68 |he tree.| And wh|
|00002750| 65 6e 20 79 6f 75 20 74 | 68 69 6e 6b 20 6f 66 20 |en you t|hink of |
|00002760| 74 68 65 20 64 69 66 66 | 65 72 65 6e 63 65 20 62 |the diff|erence b|
|00002770| 65 74 77 65 65 6e 20 61 | 6e 20 ff 00 15 0a 01 f7 |etween a|n ......|
|00002780| 69 6e 73 74 61 6e 63 65 | ff 00 15 0a 00 f7 20 6f |instance|...... o|
|00002790| 66 20 61 6e 20 6f 62 6a | 65 63 74 20 61 6e 64 20 |f an obj|ect and |
|000027a0| 61 20 ff 00 15 0a 01 f7 | 63 6c 61 73 73 ff 00 15 |a ......|class...|
|000027b0| 0a 00 f7 20 6f 66 20 6f | 62 6a 65 63 74 2c 20 72 |... of o|bject, r|
|000027c0| 65 6d 65 6d 62 65 72 20 | 74 68 61 74 20 61 72 65 |emember |that are|
|000027d0| 20 61 73 20 64 69 66 66 | 65 72 65 6e 74 20 61 73 | as diff|erent as|
|000027e0| 20 61 20 63 61 72 20 61 | 6e 64 20 61 20 66 61 63 | a car a|nd a fac|
|000027f0| 74 6f 72 79 20 74 68 61 | 74 20 70 72 6f 64 75 63 |tory tha|t produc|
|00002800| 65 73 20 63 61 72 73 2e | 20 20 54 68 69 73 20 63 |es cars.| This c|
|00002810| 61 6e 20 62 65 20 64 69 | 66 66 69 63 75 6c 74 20 |an be di|fficult |
|00002820| 66 6f 72 20 62 65 67 69 | 6e 6e 65 72 73 20 75 73 |for begi|nners us|
|00002830| 69 6e 67 20 49 6e 74 65 | 72 66 61 63 65 20 42 75 |ing Inte|rface Bu|
|00002840| 69 6c 64 65 72 20 62 65 | 63 61 75 73 65 20 62 6f |ilder be|cause bo|
|00002850| 74 68 20 63 6c 61 73 73 | 65 73 20 61 6e 64 20 69 |th class|es and i|
|00002860| 6e 73 74 61 6e 63 65 73 | 20 61 72 65 20 72 65 70 |nstances| are rep|
|00002870| 72 65 73 65 6e 74 65 64 | 20 62 79 20 73 6d 61 6c |resented| by smal|
|00002880| 6c 20 77 69 6e 64 6f 77 | 73 20 74 68 61 74 20 61 |l window|s that a|
|00002890| 72 65 20 76 65 72 79 20 | 63 6c 6f 73 65 20 74 6f |re very |close to|
|000028a0| 67 65 74 68 65 72 20 61 | 6e 64 20 6c 6f 6f 6b 20 |gether a|nd look |
|000028b0| 73 69 6d 69 6c 61 72 2e | 20 20 42 6f 74 68 20 63 |similar.| Both c|
|000028c0| 6c 61 73 73 65 73 20 61 | 6e 64 20 69 6e 73 74 61 |lasses a|nd insta|
|000028d0| 6e 63 65 73 20 6f 66 20 | 6f 62 6a 65 63 74 73 20 |nces of |objects |
|000028e0| 63 61 6e 20 62 65 20 63 | 68 61 6e 67 65 64 2e 20 |can be c|hanged. |
|000028f0| 20 43 68 61 6e 67 69 6e | 67 20 74 68 65 20 66 61 | Changin|g the fa|
|00002900| 63 74 6f 72 79 20 74 68 | 61 74 20 70 72 6f 64 75 |ctory th|at produ|
|00002910| 63 65 73 20 63 61 72 73 | 20 63 6f 75 6c 64 20 63 |ces cars| could c|
|00002920| 68 61 6e 67 65 20 73 6f | 6d 65 20 61 73 70 65 63 |hange so|me aspec|
|00002930| 74 20 6f 66 20 65 76 65 | 72 79 20 63 61 72 20 70 |t of eve|ry car p|
|00002940| 72 6f 64 75 63 65 64 20 | 62 79 20 74 68 61 74 20 |roduced |by that |
|00002950| 66 61 63 74 6f 72 79 2e | 20 20 42 75 74 20 63 68 |factory.| But ch|
|00002960| 61 6e 67 69 6e 67 20 6f | 6e 65 20 73 69 6e 67 6c |anging o|ne singl|
|00002970| 65 20 63 61 72 20 77 6f | 75 6c 64 20 6e 6f 74 20 |e car wo|uld not |
|00002980| 68 61 76 65 20 61 20 64 | 69 72 65 63 74 20 65 66 |have a d|irect ef|
|00002990| 66 65 63 74 20 6f 6e 20 | 61 6c 6c 20 6f 74 68 65 |fect on |all othe|
|000029a0| 72 20 63 61 72 73 20 6f | 66 20 69 74 73 20 63 6c |r cars o|f its cl|
|000029b0| 61 73 73 2e 0d 03 c5 0d | 57 65 20 77 69 6c 6c 20 |ass.....|We will |
|000029c0| 61 6c 73 6f 20 75 73 65 | 20 73 6f 6d 65 20 6e 65 |also use| some ne|
|000029d0| 77 20 74 65 72 6d 69 6e | 6f 6c 6f 67 79 20 74 6f |w termin|ology to|
|000029e0| 20 64 65 73 63 72 69 62 | 65 20 74 68 65 20 72 65 | describ|e the re|
|000029f0| 6c 61 74 69 6f 6e 73 68 | 69 70 20 62 65 74 77 65 |lationsh|ip betwe|
|00002a00| 65 6e 20 63 6c 61 73 73 | 65 73 2e 20 20 49 6e 20 |en class|es. In |
|00002a10| 74 68 65 20 65 78 61 6d | 70 6c 65 20 61 62 6f 76 |the exam|ple abov|
|00002a20| 65 2c 20 77 65 20 77 6f | 75 6c 64 20 73 61 79 20 |e, we wo|uld say |
|00002a30| 74 68 61 74 20 48 75 6d | 61 6e 73 20 61 72 65 20 |that Hum|ans are |
|00002a40| 61 20 ff 00 15 0a 01 f7 | 73 75 70 65 72 2d 63 6c |a ......|super-cl|
|00002a50| 61 73 73 ff 00 15 0a 00 | f7 20 6f 66 20 53 74 75 |ass.....|. of Stu|
|00002a60| 64 65 6e 74 73 20 61 6e | 64 20 74 68 61 74 20 48 |dents an|d that H|
|00002a70| 75 6d 61 6e 73 20 61 72 | 65 20 61 20 ff 00 15 0a |umans ar|e a ....|
|00002a80| 01 f7 73 75 62 2d 63 6c | 61 73 73 ff 00 15 0a 00 |..sub-cl|ass.....|
|00002a90| f7 20 6f 66 20 6d 61 6d | 6d 61 6c 73 2e ff 00 15 |. of mam|mals....|
|00002aa0| 0a 01 f7 0d ff 00 15 0a | 00 f7 0d 57 68 65 6e 20 |........|...When |
|00002ab0| 77 65 20 63 72 65 61 74 | 65 20 61 20 6e 65 77 20 |we creat|e a new |
|00002ac0| 63 6c 61 73 73 2c 20 77 | 65 20 69 6e 68 65 72 69 |class, w|e inheri|
|00002ad0| 74 20 61 6c 6c 20 74 68 | 65 20 69 6e 73 74 61 6e |t all th|e instan|
|00002ae0| 63 65 20 76 61 72 69 61 | 62 6c 65 73 20 61 73 20 |ce varia|bles as |
|00002af0| 77 65 6c 6c 20 61 73 20 | 6d 65 74 68 6f 64 73 20 |well as |methods |
|00002b00| 64 65 66 69 6e 65 64 20 | 69 6e 20 69 74 73 20 73 |defined |in its s|
|00002b10| 75 70 65 72 2d 63 6c 61 | 73 73 2e 20 20 49 74 20 |uper-cla|ss. It |
|00002b20| 69 6e 20 74 75 72 6e 20 | 69 6e 68 65 72 69 74 73 |in turn |inherits|
|00002b30| 20 61 6c 6c 20 74 68 65 | 20 69 6e 73 74 61 6e 63 | all the| instanc|
|00002b40| 65 73 20 61 6e 64 20 6d | 65 74 68 6f 64 73 20 6f |es and m|ethods o|
|00002b50| 66 20 61 6c 6c 20 74 68 | 65 20 73 75 70 65 72 2d |f all th|e super-|
|00002b60| 63 6c 61 73 73 65 73 20 | 61 62 6f 76 65 20 69 74 |classes |above it|
|00002b70| 2e 20 20 54 68 69 73 20 | 69 73 20 6f 6e 65 20 6f |. This |is one o|
|00002b80| 66 20 74 68 65 20 70 72 | 69 6e 63 69 70 61 6c 20 |f the pr|incipal |
|00002b90| 77 61 79 73 20 74 68 61 | 74 20 77 65 20 72 65 2d |ways tha|t we re-|
|00002ba0| 75 73 65 20 70 72 6f 67 | 72 61 6d 73 20 69 6e 20 |use prog|rams in |
|00002bb0| 6f 62 6a 65 63 74 20 6f | 72 69 65 6e 74 65 64 20 |object o|riented |
|00002bc0| 70 72 6f 67 72 61 6d 6d | 69 6e 67 2e 20 20 20 57 |programm|ing. W|
|00002bd0| 65 20 66 69 6e 64 20 74 | 68 65 20 6f 62 6a 65 63 |e find t|he objec|
|00002be0| 74 20 69 6e 20 61 6e 20 | 69 6e 68 65 72 69 74 61 |t in an |inherita|
|00002bf0| 6e 63 65 20 74 72 65 65 | 20 74 68 61 74 20 6d 6f |nce tree| that mo|
|00002c00| 73 74 20 63 6c 6f 73 65 | 6c 79 20 6d 61 74 63 68 |st close|ly match|
|00002c10| 65 73 20 6f 75 72 20 70 | 72 6f 62 6c 65 6d 20 61 |es our p|roblem a|
|00002c20| 6e 64 20 6d 61 6b 65 20 | 65 78 74 65 6e 73 69 6f |nd make |extensio|
|00002c30| 6e 73 20 74 6f 20 69 74 | 20 66 72 6f 6d 20 74 68 |ns to it| from th|
|00002c40| 65 72 65 2e 20 20 54 68 | 65 72 65 20 61 72 65 20 |ere. Th|ere are |
|00002c50| 77 61 79 73 20 74 6f 20 | 63 72 65 61 74 65 20 6e |ways to |create n|
|00002c60| 65 77 20 73 74 72 75 63 | 74 75 72 65 73 20 61 73 |ew struc|tures as|
|00002c70| 20 77 65 6c 6c 20 61 73 | 20 63 68 61 6e 67 65 20 | well as| change |
|00002c80| 65 78 69 73 74 69 6e 67 | 20 73 74 72 75 63 74 75 |existing| structu|
|00002c90| 72 65 73 20 74 6f 20 6d | 65 65 74 20 6f 75 72 20 |res to m|eet our |
|00002ca0| 6e 65 65 64 73 2e 0d 0d | 4c 65 74 20 75 73 20 6e |needs...|Let us n|
|00002cb0| 6f 77 20 74 61 6b 65 20 | 61 20 63 6c 6f 73 65 20 |ow take |a close |
|00002cc0| 6c 6f 6f 6b 20 61 74 20 | 74 68 65 20 69 6e 68 65 |look at |the inhe|
|00002cd0| 72 69 74 61 6e 63 65 20 | 74 72 65 65 20 66 6f 72 |ritance |tree for|
|00002ce0| 20 74 68 65 20 4e 65 78 | 74 53 74 65 70 20 41 70 | the Nex|tStep Ap|
|00002cf0| 70 6c 69 63 61 74 69 6f | 6e 20 4b 69 74 2e 20 20 |plicatio|n Kit. |
|00002d00| 54 68 69 73 20 69 73 20 | 61 20 74 6f 6f 6c 2d 6b |This is |a tool-k|
|00002d10| 69 74 20 6f 66 20 6f 62 | 6a 65 63 74 73 20 74 68 |it of ob|jects th|
|00002d20| 61 74 20 77 65 20 63 61 | 6e 20 75 73 65 20 74 6f |at we ca|n use to|
|00002d30| 20 62 75 69 6c 64 20 61 | 70 70 6c 69 63 61 74 69 | build a|pplicati|
|00002d40| 6f 6e 73 2e 20 20 54 68 | 65 20 73 74 72 75 63 74 |ons. Th|e struct|
|00002d50| 75 72 65 20 66 6f 72 20 | 74 68 69 73 20 74 72 65 |ure for |this tre|
|00002d60| 65 20 69 73 20 67 69 76 | 65 6e 20 69 73 20 66 69 |e is giv|en is fi|
|00002d70| 67 75 72 65 20 34 2d 34 | 2e 0d 0d 0d 00 28 ff 00 |gure 4-4|.....(..|
|00002d80| 15 0c 00 f7 0d fb 00 00 | 00 01 01 57 01 c3 41 70 |........|...W..Ap|
|00002d90| 70 6b 69 74 48 69 65 72 | 2e 36 32 35 35 30 31 2e |pkitHier|.625501.|
|00002da0| 65 70 73 f7 0d 0d 05 e3 | fc 00 6c 02 0a 00 6c 02 |eps.....|..l...l.|
|00002db0| 0e 02 1c 06 30 f7 ff 00 | 15 0a 01 f7 46 69 67 75 |....0...|....Figu|
|00002dc0| 72 65 20 34 2d 34 3a 20 | 41 70 70 6c 69 63 61 74 |re 4-4: |Applicat|
|00002dd0| 69 6f 6e 20 4b 69 74 20 | 49 6e 68 65 72 69 74 61 |ion Kit |Inherita|
|00002de0| 6e 63 65 20 48 69 65 72 | 61 72 63 68 79 ff 00 15 |nce Hier|archy...|
|00002df0| 0c 00 f7 0d fc 00 6c 02 | 0a 00 6c 00 0e 02 1c 06 |......l.|..l.....|
|00002e00| 30 f7 0d ff 00 15 0a 00 | f7 55 6e 64 65 72 73 74 |0.......|.Underst|
|00002e10| 61 6e 64 69 6e 67 20 74 | 68 65 20 73 74 72 75 63 |anding t|he struc|
|00002e20| 74 75 72 65 20 6f 66 20 | 74 68 65 20 61 70 70 6c |ture of |the appl|
|00002e30| 69 63 61 74 69 6f 6e 20 | 6b 69 74 20 69 73 20 6e |ication |kit is n|
|00002e40| 65 63 65 73 73 61 72 79 | 20 69 66 20 77 65 20 61 |ecessary| if we a|
|00002e50| 72 65 20 74 6f 20 62 65 | 20 61 62 6c 65 20 74 6f |re to be| able to|
|00002e60| 20 75 73 65 20 74 68 65 | 20 61 70 70 6c 69 63 61 | use the| applica|
|00002e70| 74 69 6f 6e 20 6b 69 74 | 20 61 6e 64 20 65 78 74 |tion kit| and ext|
|00002e80| 65 6e 64 20 74 68 65 20 | 75 73 65 72 20 69 6e 74 |end the |user int|
|00002e90| 65 72 66 61 63 65 20 6f | 62 6a 65 63 74 73 20 74 |erface o|bjects t|
|00002ea0| 6f 20 6d 65 65 74 20 6f | 75 72 20 6e 65 65 64 73 |o meet o|ur needs|
|00002eb0| 2e 0d 0d 41 74 20 74 68 | 65 20 74 6f 70 20 6f 66 |...At th|e top of|
|00002ec0| 20 74 68 65 20 73 74 72 | 75 63 74 75 72 65 20 77 | the str|ucture w|
|00002ed0| 65 20 73 65 65 20 61 20 | 62 6f 78 20 74 69 74 6c |e see a |box titl|
|00002ee0| 65 64 20 22 4f 62 6a 65 | 63 74 22 2e 20 20 54 68 |ed "Obje|ct". Th|
|00002ef0| 69 73 20 69 73 20 74 68 | 65 20 6d 6f 73 74 20 67 |is is th|e most g|
|00002f00| 65 6e 65 72 69 63 20 6f | 62 6a 65 63 74 20 69 6e |eneric o|bject in|
|00002f10| 20 74 68 65 20 74 72 65 | 65 2e 20 20 49 74 20 68 | the tre|e. It h|
|00002f20| 61 73 20 74 68 65 20 66 | 65 77 65 73 74 20 73 70 |as the f|ewest sp|
|00002f30| 65 63 69 61 6c 69 7a 65 | 64 20 63 68 61 72 61 63 |ecialize|d charac|
|00002f40| 74 65 72 69 73 74 69 63 | 73 20 6f 66 20 61 6e 79 |teristic|s of any|
|00002f50| 20 6f 66 20 74 68 65 20 | 41 70 70 6c 69 63 61 74 | of the |Applicat|
|00002f60| 69 6f 6e 20 4b 69 74 20 | 6f 62 6a 65 63 74 73 2e |ion Kit |objects.|
|00002f70| 20 20 41 6e 79 20 63 68 | 61 72 61 63 74 65 72 69 | Any ch|aracteri|
|00002f80| 73 74 69 63 20 6f 66 20 | 74 68 65 20 6f 62 6a 65 |stic of |the obje|
|00002f90| 63 74 20 63 6c 61 73 73 | 20 77 69 6c 6c 20 62 65 |ct class| will be|
|00002fa0| 20 73 68 61 72 65 64 20 | 77 69 74 68 20 61 6c 6c | shared |with all|
|00002fb0| 20 6f 74 68 65 72 20 61 | 70 70 6b 69 74 20 6f 62 | other a|ppkit ob|
|00002fc0| 6a 65 63 74 73 2e 20 20 | 44 69 72 65 63 74 6c 79 |jects. |Directly|
|00002fd0| 20 62 65 6c 6f 77 20 74 | 68 65 20 6f 62 6a 65 63 | below t|he objec|
|00002fe0| 74 20 63 6c 61 73 73 20 | 69 73 20 74 68 65 20 52 |t class |is the R|
|00002ff0| 65 73 70 6f 6e 64 65 72 | 20 63 6c 61 73 73 2e 20 |esponder| class. |
|00003000| 20 54 68 69 73 20 63 6f | 6e 73 69 73 74 73 20 6f | This co|nsists o|
|00003010| 66 20 61 6c 6c 20 6f 62 | 6a 65 63 74 73 20 74 68 |f all ob|jects th|
|00003020| 61 74 20 63 61 6e 20 72 | 65 73 70 6f 6e 64 20 74 |at can r|espond t|
|00003030| 6f 20 75 73 65 72 20 67 | 65 6e 65 72 61 74 65 64 |o user g|enerated|
|00003040| 20 65 76 65 6e 74 73 20 | 73 75 63 68 20 61 73 20 | events |such as |
|00003050| 70 72 65 73 73 69 6e 67 | 20 74 68 65 20 6d 6f 75 |pressing| the mou|
|00003060| 73 65 20 61 6e 64 20 74 | 79 70 69 6e 67 20 6f 6e |se and t|yping on|
|00003070| 20 74 68 65 20 6b 65 79 | 62 6f 61 72 64 2e 20 20 | the key|board. |
|00003080| 54 6f 20 74 68 65 20 6c | 6f 77 65 72 20 72 69 67 |To the l|ower rig|
|00003090| 68 74 20 6f 66 20 74 68 | 65 20 52 65 73 70 6f 6e |ht of th|e Respon|
|000030a0| 64 65 72 20 69 73 20 74 | 68 65 20 56 69 65 77 20 |der is t|he View |
|000030b0| 63 6c 61 73 73 2e 20 20 | 41 6c 6c 20 6f 62 6a 65 |class. |All obje|
|000030c0| 63 74 73 20 74 68 61 74 | 20 61 72 65 20 6f 6e 20 |cts that| are on |
|000030d0| 74 68 65 20 73 63 72 65 | 65 6e 20 61 72 65 20 61 |the scre|en are a|
|000030e0| 20 73 75 62 63 6c 61 73 | 73 20 6f 66 20 74 68 65 | subclas|s of the|
|000030f0| 20 56 69 65 77 20 63 6c | 61 73 73 2e 20 20 42 65 | View cl|ass. Be|
|00003100| 6c 6f 77 20 74 68 65 20 | 56 69 65 77 20 63 6c 61 |low the |View cla|
|00003110| 73 73 20 69 73 20 74 68 | 65 20 43 6f 6e 74 72 6f |ss is th|e Contro|
|00003120| 6c 20 63 6c 61 73 73 2e | 20 20 41 6c 6c 20 63 6c |l class.| All cl|
|00003130| 61 73 73 65 73 20 77 68 | 69 63 68 20 61 72 65 20 |asses wh|ich are |
|00003140| 73 75 62 2d 63 6c 61 73 | 73 65 73 20 6f 66 20 74 |sub-clas|ses of t|
|00003150| 68 65 20 43 6f 6e 74 72 | 6f 6c 20 77 69 6c 6c 20 |he Contr|ol will |
|00003160| 72 65 73 70 6f 6e 64 20 | 74 6f 20 65 76 65 6e 74 |respond |to event|
|00003170| 73 20 62 79 20 73 65 6e | 64 69 6e 67 20 6d 65 73 |s by sen|ding mes|
|00003180| 73 61 67 65 20 64 69 72 | 65 63 74 6c 79 20 74 6f |sage dir|ectly to|
|00003190| 20 6f 74 68 65 72 20 6f | 62 6a 65 63 74 73 2e 20 | other o|bjects. |
|000031a0| 20 54 68 65 79 20 63 61 | 6e 20 73 65 72 76 65 20 | They ca|n serve |
|000031b0| 61 73 20 63 6f 6e 74 72 | 6f 6c 6c 65 72 20 69 6e |as contr|oller in|
|000031c0| 70 75 74 73 20 74 6f 20 | 6f 75 72 20 63 75 73 74 |puts to |our cust|
|000031d0| 6f 6d 20 6f 62 6a 65 63 | 74 73 2e 20 20 4f 6e 65 |om objec|ts. One|
|000031e0| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 61 20 63 6f | example| of a co|
|000031f0| 6e 74 72 6f 6c 20 69 73 | 20 74 68 65 20 42 75 74 |ntrol is| the But|
|00003200| 74 6f 6e 20 63 6c 61 73 | 73 2e 20 49 66 20 77 65 |ton clas|s. If we|
|00003210| 20 74 61 6b 65 20 61 20 | 63 6c 6f 73 65 72 20 6c | take a |closer l|
|00003220| 6f 6f 6b 20 61 74 20 74 | 68 65 20 ff 00 15 0a 01 |ook at t|he .....|
|00003230| f7 62 ff 00 15 0a 00 f7 | 75 74 74 6f 6e 20 63 6c |.b......|utton cl|
|00003240| 61 73 73 20 77 65 20 77 | 69 6c 6c 20 73 65 65 20 |ass we w|ill see |
|00003250| 74 68 61 74 20 6d 6f 73 | 74 20 6f 66 20 74 68 65 |that mos|t of the|
|00003260| 20 63 68 61 72 61 63 74 | 65 72 69 73 74 69 63 73 | charact|eristics|
|00003270| 20 6f 66 20 74 68 65 20 | 42 75 74 74 6f 6e 20 63 | of the |Button c|
|00003280| 6c 61 73 73 20 61 72 65 | 20 6e 6f 74 20 63 72 65 |lass are| not cre|
|00003290| 61 74 65 64 20 69 6e 20 | 74 68 65 20 6f 62 6a 65 |ated in |the obje|
|000032a0| 63 74 20 69 74 73 65 6c | 66 20 62 75 74 20 61 72 |ct itsel|f but ar|
|000032b0| 69 73 65 20 66 72 6f 6d | 20 69 74 73 20 6c 6f 63 |ise from| its loc|
|000032c0| 61 74 69 6f 6e 20 69 6e | 20 74 68 65 20 69 6e 68 |ation in| the inh|
|000032d0| 65 72 69 74 61 6e 63 65 | 20 74 72 65 65 2e 20 20 |eritance| tree. |
|000032e0| 4c 65 74 73 20 74 61 6b | 65 20 61 20 63 6c 6f 73 |Lets tak|e a clos|
|000032f0| 65 72 20 6c 6f 6f 6b 20 | 61 74 20 74 68 65 20 64 |er look |at the d|
|00003300| 6f 63 75 6d 65 6e 74 61 | 74 69 6f 6e 20 4e 65 58 |ocumenta|tion NeX|
|00003310| 54 20 70 72 6f 76 69 64 | 65 73 20 61 62 6f 75 74 |T provid|es about|
|00003320| 20 74 68 65 20 42 75 74 | 74 6f 6e 20 63 6c 61 73 | the But|ton clas|
|00003330| 73 2e 20 20 49 74 20 63 | 61 6e 20 62 65 20 66 6f |s. It c|an be fo|
|00003340| 75 6e 64 20 69 6e 20 74 | 68 65 20 66 6f 6c 6c 6f |und in t|he follo|
|00003350| 77 69 6e 67 20 70 61 74 | 68 20 6f 66 20 74 68 65 |wing pat|h of the|
|00003360| 20 4e 65 58 54 20 6f 6e | 2d 6c 69 6e 65 20 64 6f | NeXT on|-line do|
|00003370| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 20 28 73 65 65 |cumentat|ion (see|
|00003380| 20 66 69 67 75 72 65 20 | 35 29 0d 00 8f ff 00 15 | figure |5)......|
|00003390| 0c 00 f7 0d 0d ff 00 14 | 09 00 f7 28 66 72 6f 6d |........|...(from|
|000033a0| 20 2f 4e 65 78 74 4c 69 | 62 72 61 72 79 2f 44 6f | /NextLi|brary/Do|
|000033b0| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 2f 4e 65 58 54 |cumentat|ion/NeXT|
|000033c0| 2f 53 79 73 52 65 66 4d | 61 6e 2f 32 31 43 6c 61 |/SysRefM|an/21Cla|
|000033d0| 73 73 53 70 65 63 73 2f | 41 70 70 6b 69 74 2f 42 |ssSpecs/|Appkit/B|
|000033e0| 75 74 74 6f 6e 2e 77 6e | 29 ff 00 14 0b 00 f7 0d |utton.wn|).......|
|000033f0| 0d fc 00 6c 02 2e 00 6c | 00 0d 02 1c 06 30 f7 ff |...l...l|.....0..|
|00003400| 00 14 0d 01 f7 42 75 74 | 74 6f 6e ff 00 14 09 01 |.....But|ton.....|
|00003410| f7 0d f9 00 f7 ff 00 14 | 09 00 f7 0d 03 b8 ff 00 |........|........|
|00003420| 14 0b 00 f7 49 4e 48 45 | 52 49 54 53 20 46 52 4f |....INHE|RITS FRO|
|00003430| 4d 09 43 6f 6e 74 72 6f | 6c 20 3a 20 56 69 65 77 |M.Contro|l : View|
|00003440| 20 3a 20 52 65 73 70 6f | 6e 64 65 72 20 3a 20 4f | : Respo|nder : O|
|00003450| 62 6a 65 63 74 0d 0d 0d | 49 4e 53 54 41 4e 43 45 |bject...|INSTANCE|
|00003460| 20 56 41 52 49 41 42 4c | 45 53 0d 0d f9 00 f7 ff | VARIABL|ES......|
|00003470| 00 14 0b 02 f7 49 6e 68 | 65 72 69 74 65 64 20 66 |.....Inh|erited f|
|00003480| 72 6f 6d 20 4f 62 6a 65 | 63 74 f9 00 f7 ff 00 14 |rom Obje|ct......|
|00003490| 0b 00 f7 09 73 74 72 75 | 63 74 20 5f 53 48 41 52 |....stru|ct _SHAR|
|000034a0| 45 44 09 2a 69 73 61 3b | 0d 0d f9 00 f7 ff 00 14 |ED.*isa;|........|
|000034b0| 0b 02 f7 49 6e 68 65 72 | 69 74 65 64 20 66 72 6f |...Inher|ited fro|
|000034c0| 6d 20 52 65 73 70 6f 6e | 64 65 72 f9 00 f7 ff 00 |m Respon|der.....|
|000034d0| 14 0b 00 f7 09 69 64 09 | 6e 65 78 74 52 65 73 70 |.....id.|nextResp|
|000034e0| 6f 6e 64 65 72 3b 0d 0d | f9 00 f7 ff 00 14 0b 02 |onder;..|........|
|000034f0| f7 49 6e 68 65 72 69 74 | 65 64 20 66 72 6f 6d 20 |.Inherit|ed from |
|00003500| 56 69 65 77 f9 00 f7 ff | 00 14 0b 00 f7 09 4e 58 |View....|......NX|
|00003510| 52 65 63 74 09 66 72 61 | 6d 65 3b 20 09 4e 58 52 |Rect.fra|me; .NXR|
|00003520| 65 63 74 09 62 6f 75 6e | 64 73 3b 20 09 69 64 09 |ect.boun|ds; .id.|
|00003530| 73 75 70 65 72 76 69 65 | 77 3b 20 09 69 64 09 73 |supervie|w; .id.s|
|00003540| 75 62 76 69 65 77 73 3b | 20 09 69 64 09 77 69 6e |ubviews;| .id.win|
|00003550| 64 6f 77 3b 20 09 73 74 | 72 75 63 74 20 5f 5f 76 |dow; .st|ruct __v|
|00003560| 46 6c 61 67 73 09 76 46 | 6c 61 67 73 3b 0d 0d f9 |Flags.vF|lags;...|
|00003570| 00 f7 ff 00 14 0b 02 f7 | 49 6e 68 65 72 69 74 65 |........|Inherite|
|00003580| 64 20 66 72 6f 6d 20 43 | 6f 6e 74 72 6f 6c f9 00 |d from C|ontrol..|
|00003590| f7 ff 00 14 0b 00 f7 09 | 69 6e 74 09 74 61 67 3b |........|int.tag;|
|000035a0| 20 09 69 64 09 63 65 6c | 6c 3b 20 09 73 74 72 75 | .id.cel|l; .stru|
|000035b0| 63 74 20 5f 63 6f 6e 46 | 6c 61 67 73 09 63 6f 6e |ct _conF|lags.con|
|000035c0| 46 6c 61 67 73 3b 0d 0d | f9 00 f7 ff 00 14 0b 02 |Flags;..|........|
|000035d0| f7 44 65 63 6c 61 72 65 | 64 20 69 6e 20 42 75 74 |.Declare|d in But|
|000035e0| 74 6f 6e f9 00 f7 ff 00 | 14 0b 00 f7 09 28 6e 6f |ton.....|.....(no|
|000035f0| 6e 65 29 0d fc 00 6c 02 | 0a 00 6c 00 0e 02 1c 06 |ne)...l.|..l.....|
|00003600| 30 f7 0d fc 00 6c 02 0a | 00 6c 02 0e 02 1c 06 30 |0....l..|.l.....0|
|00003610| f7 ff 00 15 0a 01 f7 46 | 69 67 75 72 65 20 34 2d |.......F|igure 4-|
|00003620| 35 3a 20 43 6c 61 73 73 | 20 73 70 65 63 69 66 69 |5: Class| specifi|
|00003630| 63 61 74 69 6f 6e 20 66 | 6f 72 20 74 68 65 20 42 |cation f|or the B|
|00003640| 75 74 74 6f 6e 20 43 6c | 61 73 73 ff 00 15 0c 00 |utton Cl|ass.....|
|00003650| f7 0d fc 00 6c 02 0a 00 | 6c 00 0e 02 1c 06 30 f7 |....l...|l.....0.|
|00003660| 0d ff 00 15 0a 00 f7 54 | 68 65 20 66 69 72 73 74 |.......T|he first|
|00003670| 20 6c 69 6e 65 20 6f 66 | 20 74 68 65 20 73 70 65 | line of| the spe|
|00003680| 63 69 66 69 63 61 74 69 | 6f 6e 20 73 68 65 65 74 |cificati|on sheet|
|00003690| 20 72 65 61 64 73 3a 0d | 0d fc 00 6c 02 2e 00 6c | reads:.|...l...l|
|000036a0| 00 0d 02 1c 06 30 f7 ff | 00 14 0b 00 f7 49 4e 48 |.....0..|.....INH|
|000036b0| 45 52 49 54 53 20 46 52 | 4f 4d 09 43 6f 6e 74 72 |ERITS FR|OM.Contr|
|000036c0| 6f 6c 20 3a 20 56 69 65 | 77 20 3a 20 52 65 73 70 |ol : Vie|w : Resp|
|000036d0| 6f 6e 64 65 72 20 3a 20 | 4f 62 6a 65 63 74 0d fc |onder : |Object..|
|000036e0| 00 6c 02 0a 00 6c 00 0e | 02 1c 06 30 f7 ff 00 15 |.l...l..|...0....|
|000036f0| 0c 00 f7 0d ff 00 15 0a | 00 f7 54 68 69 73 20 73 |........|..This s|
|00003700| 68 6f 77 73 20 79 6f 75 | 20 74 68 65 20 64 69 72 |hows you| the dir|
|00003710| 65 63 74 20 61 6e 63 65 | 73 74 6f 72 73 20 6f 66 |ect ance|stors of|
|00003720| 20 74 68 65 20 42 75 74 | 74 6f 6e 20 63 6c 61 73 | the But|ton clas|
|00003730| 73 2e 20 20 42 65 6c 6f | 77 20 74 68 61 74 20 77 |s. Belo|w that w|
|00003740| 65 20 68 61 76 65 20 74 | 68 65 20 69 6e 73 74 61 |e have t|he insta|
|00003750| 6e 63 65 20 76 61 72 69 | 61 62 6c 65 73 20 66 6f |nce vari|ables fo|
|00003760| 72 20 65 61 63 68 20 6f | 66 20 74 68 65 73 65 20 |r each o|f these |
|00003770| 6c 65 76 65 6c 73 2e 20 | 20 54 68 65 20 6d 65 6e |levels. | The men|
|00003780| 74 61 6c 20 70 69 63 74 | 75 72 65 20 77 65 20 63 |tal pict|ure we c|
|00003790| 72 65 61 74 65 20 66 6f | 72 20 74 68 65 20 42 75 |reate fo|r the Bu|
|000037a0| 74 74 6f 6e 20 63 6c 61 | 73 73 20 6d 69 67 68 74 |tton cla|ss might|
|000037b0| 20 6c 6f 6f 6b 20 73 6f | 6d 65 74 68 69 6e 67 20 | look so|mething |
|000037c0| 6c 69 6b 65 20 66 69 67 | 75 72 65 20 36 2e 0d ff |like fig|ure 6...|
|000037d0| 00 15 0c 00 f7 0d 00 33 | fc 00 6c 02 2e 00 6c 02 |.......3|..l...l.|
|000037e0| 0d 02 1c 06 30 f7 ff 00 | 14 0e 00 f7 fb 00 00 00 |....0...|........|
|000037f0| 01 01 47 01 09 57 4e 47 | 72 61 70 68 69 63 2e 32 |..G..WNG|raphic.2|
|00003800| 31 34 36 37 30 2e 65 70 | 73 f7 0d 02 32 ff 00 15 |14670.ep|s...2...|
|00003810| 0e 00 f7 0d ff 00 15 0a | 01 f7 46 69 67 75 72 65 |........|..Figure|
|00003820| 20 34 2d 36 3a 20 42 75 | 74 74 6f 6e 20 49 6e 68 | 4-6: Bu|tton Inh|
|00003830| 65 72 69 74 61 6e 63 65 | 20 48 69 65 72 61 72 63 |eritance| Hierarc|
|00003840| 68 79 ff 00 15 0e 00 f7 | 0d fc 00 6c 02 2e 00 6c |hy......|...l...l|
|00003850| 00 0d 02 1c 06 30 f7 0d | ff 00 15 0a 00 f7 49 66 |.....0..|......If|
|00003860| 20 77 65 20 63 72 65 61 | 74 65 20 61 20 62 75 74 | we crea|te a but|
|00003870| 74 6f 6e 20 6f 66 20 6f | 75 72 20 6f 77 6e 20 74 |ton of o|ur own t|
|00003880| 68 61 74 20 6e 65 65 64 | 65 64 20 74 6f 20 6b 6e |hat need|ed to kn|
|00003890| 6f 77 20 74 68 65 20 62 | 6f 75 6e 64 73 20 6f 66 |ow the b|ounds of|
|000038a0| 20 74 68 65 20 62 75 74 | 74 6f 6e 2c 20 77 65 20 | the but|ton, we |
|000038b0| 77 6f 75 6c 64 20 61 63 | 63 65 73 73 20 74 68 65 |would ac|cess the|
|000038c0| 20 62 6f 75 6e 64 73 20 | 69 6e 20 6f 75 72 20 6f | bounds |in our o|
|000038d0| 77 6e 20 62 75 74 74 6f | 6e 20 61 73 20 74 68 65 |wn butto|n as the|
|000038e0| 20 76 61 72 69 61 62 6c | 65 20 22 62 6f 75 6e 64 | variabl|e "bound|
|000038f0| 73 22 2e 20 20 54 68 65 | 20 62 6f 75 6e 64 73 20 |s". The| bounds |
|00003900| 77 6f 75 6c 64 20 61 63 | 74 75 61 6c 6c 79 20 63 |would ac|tually c|
|00003910| 6f 6d 65 20 66 72 6f 6d | 20 74 68 65 20 73 74 61 |ome from| the sta|
|00003920| 74 65 20 76 61 72 69 61 | 62 6c 65 20 6f 66 20 74 |te varia|ble of t|
|00003930| 68 65 20 56 69 65 77 20 | 63 6c 61 73 73 2e 20 20 |he View |class. |
|00003940| 20 49 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 73 75 63 | Informa|tion suc|
|00003950| 68 20 61 73 20 62 6f 75 | 6e 64 73 20 69 73 20 75 |h as bou|nds is u|
|00003960| 73 65 64 20 6f 76 65 72 | 20 61 6e 64 20 6f 76 65 |sed over| and ove|
|00003970| 72 20 61 67 61 69 6e 20 | 65 76 65 72 79 20 74 69 |r again |every ti|
|00003980| 6d 65 20 77 65 20 6d 61 | 6e 69 70 75 6c 61 74 65 |me we ma|nipulate|
|00003990| 20 61 6e 79 20 6f 6e 2d | 73 63 72 65 65 6e 20 6f | any on-|screen o|
|000039a0| 62 6a 65 63 74 73 2e 20 | 20 42 79 20 72 65 2d 75 |bjects. | By re-u|
|000039b0| 73 69 6e 67 20 74 68 69 | 73 20 63 6f 64 65 20 77 |sing thi|s code w|
|000039c0| 65 20 69 6e 63 72 65 61 | 73 65 20 6f 75 72 20 70 |e increa|se our p|
|000039d0| 72 6f 64 75 63 74 69 76 | 69 74 79 20 61 6e 64 20 |roductiv|ity and |
|000039e0| 65 6e 63 6f 75 72 61 67 | 65 20 72 65 2d 75 73 65 |encourag|e re-use|
|000039f0| 20 72 61 74 68 65 72 20 | 74 68 65 6e 20 72 65 2d | rather |then re-|
|00003a00| 69 6e 76 65 6e 74 69 6f | 6e 2e 0d 0d fc 00 48 02 |inventio|n.....H.|
|00003a10| 2e 00 48 00 0d 02 1c 06 | 30 f7 ff 00 15 10 01 f7 |..H.....|0.......|
|00003a20| 45 78 65 72 63 69 73 65 | 73 ff 00 15 0a 00 f7 0d |Exercise|s.......|
|00003a30| fc 00 6c 02 2e 00 6c 00 | 0d 02 1c 06 30 f7 0d 02 |..l...l.|....0...|
|00003a40| 42 31 2e 20 42 72 69 6e | 67 20 75 70 20 49 6e 74 |B1. Brin|g up Int|
|00003a50| 65 72 66 61 63 65 20 42 | 75 69 6c 64 65 72 20 61 |erface B|uilder a|
|00003a60| 6e 64 20 64 6f 75 62 6c | 65 20 63 6c 69 63 6b 20 |nd doubl|e click |
|00003a70| 74 68 65 20 43 6c 61 73 | 73 20 45 64 69 74 6f 72 |the Clas|s Editor|
|00003a80| 20 77 69 6e 64 6f 77 20 | 62 79 20 64 6f 75 62 6c | window |by doubl|
|00003a90| 65 2d 63 6c 69 63 6b 69 | 6e 67 20 6f 6e 20 74 68 |e-clicki|ng on th|
|00003aa0| 65 20 22 43 6c 61 73 73 | 65 73 22 20 74 6f 6f 6c |e "Class|es" tool|
|00003ab0| 2d 6b 69 74 20 69 63 6f | 6e 20 69 6e 20 74 68 65 |-kit ico|n in the|
|00003ac0| 20 6c 6f 77 65 72 20 6c | 65 66 74 20 77 69 6e 64 | lower l|eft wind|
|00003ad0| 6f 77 2e 20 20 43 6f 6d | 70 61 72 65 20 74 68 69 |ow. Com|pare thi|
|00003ae0| 73 20 77 69 74 68 20 74 | 68 65 20 49 6e 68 65 72 |s with t|he Inher|
|00003af0| 69 74 61 6e 63 65 20 73 | 74 72 75 63 74 75 72 65 |itance s|tructure|
|00003b00| 20 69 6e 20 46 69 67 75 | 72 65 20 34 2d 35 2e 20 | in Figu|re 4-5. |
|00003b10| 20 57 68 61 74 20 68 61 | 70 70 65 6e 73 20 77 68 | What ha|ppens wh|
|00003b20| 65 6e 20 79 6f 75 20 74 | 72 79 20 74 6f 20 75 73 |en you t|ry to us|
|00003b30| 65 20 74 68 65 20 22 49 | 6e 73 74 61 6e 74 69 61 |e the "I|nstantia|
|00003b40| 74 65 22 20 73 65 6c 65 | 63 74 69 6f 6e 20 75 6e |te" sele|ction un|
|00003b50| 64 65 72 20 74 68 65 20 | 70 6f 70 2d 75 70 20 6c |der the |pop-up l|
|00003b60| 69 73 74 20 6c 61 62 65 | 6c 65 64 20 22 4f 70 65 |ist labe|led "Ope|
|00003b70| 72 61 74 69 6f 6e 73 22 | 2e 20 20 54 72 79 20 69 |rations"|. Try i|
|00003b80| 6e 73 74 61 6e 74 69 61 | 74 69 6e 67 20 61 6e 20 |nstantia|ting an |
|00003b90| 4f 62 6a 65 63 74 2e 20 | 20 57 68 79 20 63 61 6e |Object. | Why can|
|00003ba0| 27 74 20 79 6f 75 20 69 | 6e 73 74 61 6e 74 69 61 |'t you i|nstantia|
|00003bb0| 74 65 20 61 20 56 69 65 | 77 3f 20 20 54 72 79 20 |te a Vie|w? Try |
|00003bc0| 73 75 62 2d 63 6c 61 73 | 73 69 6e 67 20 61 20 56 |sub-clas|sing a V|
|00003bd0| 69 65 77 20 61 6e 64 20 | 63 61 6c 6c 20 69 74 20 |iew and |call it |
|00003be0| 4d 79 56 69 65 77 2e 20 | 20 49 66 20 79 6f 75 20 |MyView. | If you |
|00003bf0| 64 72 61 67 20 61 20 63 | 75 73 74 6f 6d 56 69 65 |drag a c|ustomVie|
|00003c00| 77 20 66 72 6f 6d 20 74 | 68 65 20 70 61 6c 65 74 |w from t|he palet|
|00003c10| 74 65 20 61 6e 64 20 74 | 68 65 6e 20 69 6e 73 70 |te and t|hen insp|
|00003c20| 65 63 74 20 69 74 73 20 | 61 74 74 72 69 62 75 74 |ect its |attribut|
|00003c30| 65 73 20 77 68 61 74 20 | 64 6f 20 79 6f 75 20 73 |es what |do you s|
|00003c40| 65 65 3f 20 20 43 61 6e | 20 79 6f 75 20 6d 61 6b |ee? Can| you mak|
|00003c50| 65 20 74 68 65 20 63 75 | 73 74 6f 6d 20 76 69 65 |e the cu|stom vie|
|00003c60| 77 20 61 6e 20 69 6e 73 | 74 61 6e 63 65 20 6f 66 |w an ins|tance of|
|00003c70| 20 74 68 65 20 4d 79 56 | 69 65 77 20 63 6c 61 73 | the MyV|iew clas|
|00003c80| 73 2e 0d 00 a2 64 00 08 | 1d 00 2a a6 00 07 9c 00 |s....d..|..*.....|
|00003c90| 00 a7 00 07 f3 01 a6 85 | 00 02 86 00 00 04 00 0c |........|........|
|00003ca0| b1 00 46 65 00 0d cd 01 | 04 64 00 0e 08 00 b6 6c |..Fe....|.d.....l|
|00003cb0| 00 11 d1 00 ce 24 00 15 | e7 00 39 6d 00 16 84 01 |.....$..|..9m....|
|00003cc0| 01 64 00 16 c0 00 ae 6c | 00 19 e2 00 9a 64 00 1d |.d.....l|.....d..|
|00003cd0| 29 00 cb 0c 00 04 51 00 | 9a 64 00 20 c0 00 cb 64 |).....Q.|.d. ...d|
|00003ce0| 00 24 7f 00 93 6d 00 25 | f2 00 eb 64 00 26 2d 00 |.$...m.%|...d.&-.|
|00003cf0| b7 24 00 29 b5 00 ee 2d | 00 2d 7c 01 73 64 00 2d |.$.)...-|.-|.sd.-|
|00003d00| a6 00 fd 74 00 33 8b 00 | 56 64 00 34 1c 01 df 6d |...t.3..|Vd.4...m|
|00003d10| 00 37 d6 01 4a 64 00 38 | 0b 00 9e 04 00 3a 3f 00 |.7..Jd.8|.....:?.|
|00003d20| 4e 0c 00 02 c1 00 4e 00 | 18 04 00 02 00 00 38 04 |N.....N.|......8.|
|00003d30| 00 02 06 00 38 24 00 07 | 9c 00 38 04 00 07 f3 00 |....8$..|..8.....|
|00003d40| 2a 00 55 ff 00 15 08 01 | f7 0d 0d 4f 62 6a 65 63 |*.U.....|...Objec|
|00003d50| 74 20 42 61 73 65 64 20 | 43 6f 6d 70 75 74 69 6e |t Based |Computin|
|00003d60| 67 3a 20 41 20 4e 65 78 | 74 53 74 65 70 20 54 75 |g: A Nex|tStep Tu|
|00003d70| 74 6f 72 69 61 6c 20 61 | 6e 64 20 43 6f 6f 6b 62 |torial a|nd Cookb|
|00003d80| 6f 6f 6b 20 2d 56 65 72 | 73 69 6f 6e 20 31 2e 35 |ook -Ver|sion 1.5|
|00003d90| 20 2d 20 44 47 4d 0d 0d | 00 a2 64 00 08 1d 00 2a | - DGM..|..d....*|
|00003da0| a6 00 3d 41 00 00 a7 00 | 07 f3 01 a6 85 00 02 86 |..=A....|........|
|00003db0| 00 00 04 00 0c b1 00 46 | 65 00 0d cd 01 04 64 00 |.......F|e.....d.|
|00003dc0| 0e 08 00 b6 6c 00 11 d1 | 00 ce 24 00 15 e7 00 39 |....l...|..$....9|
|00003dd0| 6d 00 16 84 01 01 64 00 | 16 c0 00 ae 6c 00 19 e2 |m.....d.|....l...|
|00003de0| 00 9a 64 00 1d 29 00 cb | 0c 00 04 51 00 9a 64 00 |..d..)..|...Q..d.|
|00003df0| 20 c0 00 cb 64 00 24 7f | 00 93 6d 00 25 f2 00 eb | ...d.$.|..m.%...|
|00003e00| 64 00 26 2d 00 b7 24 00 | 29 b5 00 ee 2d 00 2d 7c |d.&-..$.|)...-.-||
|00003e10| 01 73 64 00 2d a6 00 fd | 74 00 33 8b 00 56 64 00 |.sd.-...|t.3..Vd.|
|00003e20| 34 1c 01 df 6d 00 37 d6 | 01 4a 64 00 38 0b 00 9e |4...m.7.|.Jd.8...|
|00003e30| 04 00 3a 3f 00 4e 0c 00 | 02 c1 00 4e 00 18 04 00 |..:?.N..|...N....|
|00003e40| 02 00 00 38 04 00 02 06 | 00 38 24 00 3d 41 00 38 |...8....|.8$.=A.8|
|00003e50| 04 00 07 f3 00 2a 00 7f | ff 00 15 08 01 f7 0d 4f |.....*..|.......O|
|00003e60| 62 6a 65 63 74 20 42 61 | 73 65 64 20 43 6f 6d 70 |bject Ba|sed Comp|
|00003e70| 75 74 69 6e 67 3a 20 41 | 20 4e 65 78 74 53 74 65 |uting: A| NextSte|
|00003e80| 70 20 54 75 74 6f 72 69 | 61 6c 20 61 6e 64 20 43 |p Tutori|al and C|
|00003e90| 6f 6f 6b 62 6f 6f 6b 20 | 2d 56 65 72 73 69 6f 6e |ookbook |-Version|
|00003ea0| 20 31 2e 35 20 2d 20 44 | 47 4d 0d 43 68 61 70 74 | 1.5 - D|GM.Chapt|
|00003eb0| 65 72 20 34 20 2d 20 45 | 6e 63 61 70 73 75 6c 61 |er 4 - E|ncapsula|
|00003ec0| 74 69 6f 6e 20 61 6e 64 | 20 49 6e 68 65 72 69 74 |tion and| Inherit|
|00003ed0| 61 6e 63 65 20 0d 0d 00 | 23 0d 20 50 61 67 65 20 |ance ...|#. Page |
|00003ee0| 34 2d fd 00 f7 20 20 20 | 20 20 20 fd 01 f7 20 20 |4-... | ... |
|00003ef0| 20 20 20 20 20 20 20 fd | 02 f7 0d 0d 00 a2 64 00 | .|......d.|
|00003f00| 08 1d 00 2a a6 00 3e 56 | 00 00 a7 00 3e d7 01 a6 |...*..>V|....>...|
|00003f10| 85 00 02 86 00 00 04 00 | 0c b1 00 46 65 00 0d cd |........|...Fe...|
|00003f20| 01 04 64 00 0e 08 00 b6 | 6c 00 11 d1 00 ce 24 00 |..d.....|l.....$.|
|00003f30| 15 e7 00 39 6d 00 16 84 | 01 01 64 00 16 c0 00 ae |...9m...|..d.....|
|00003f40| 6c 00 19 e2 00 9a 64 00 | 1d 29 00 cb 0c 00 04 51 |l.....d.|.).....Q|
|00003f50| 00 9a 64 00 20 c0 00 cb | 64 00 24 7f 00 93 6d 00 |..d. ...|d.$...m.|
|00003f60| 25 f2 00 eb 64 00 26 2d | 00 b7 24 00 29 b5 00 ee |%...d.&-|..$.)...|
|00003f70| 2d 00 2d 7c 01 73 64 00 | 2d a6 00 fd 74 00 33 8b |-.-|.sd.|-...t.3.|
|00003f80| 00 56 64 00 34 1c 01 df | 6d 00 37 d6 01 4a 64 00 |.Vd.4...|m.7..Jd.|
|00003f90| 38 0b 00 9e 04 00 3a 3f | 00 4e 0c 00 02 c1 00 4e |8.....:?|.N.....N|
|00003fa0| 00 18 04 00 02 00 00 38 | 04 00 02 06 00 38 24 00 |.......8|.....8$.|
|00003fb0| 3e 56 00 38 04 00 3e d7 | 00 2a |>V.8..>.|.* |
+--------+-------------------------+-------------------------+--------+--------+