home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day24 / employee.cpp < prev    next >
MacBinary  |  2002-05-25  |  2.3 KB  |  [TEXT/LMAN]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat May 25 13:21:12 2002, modified Sat May 25 13:21:12 2002, creator 'LMAN', type ASCII, 1785 bytes "employee.cpp" , at 0x779 286 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[LMAN]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 65 6d 70 6c 6f 79 | 65 65 2e 63 70 70 00 00 |..employ|ee.cpp..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4c 4d 41 | 4e 00 00 ff ff ff ff 00 |.TEXTLMA|N.......|
|00000050| 00 00 00 00 00 06 f9 00 | 00 01 1e b9 15 78 88 b9 |........|.....x..|
|00000060| 15 78 88 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.x......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 74 ae 00 00 |........|....t...|
|00000080| 2f 2f 20 49 6e 68 65 72 | 69 74 61 6e 63 65 20 69 |// Inher|itance i|
|00000090| 6c 6c 75 73 74 72 61 74 | 65 64 0d 0a 23 69 6e 63 |llustrat|ed..#inc|
|000000a0| 6c 75 64 65 20 3c 69 6f | 73 74 72 65 61 6d 2e 68 |lude <io|stream.h|
|000000b0| 3e 0d 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 74 72 |>..#incl|ude <str|
|000000c0| 69 6e 67 2e 68 3e 0d 0a | 0d 0a 23 64 65 66 69 6e |ing.h>..|..#defin|
|000000d0| 65 20 4d 41 58 5f 4c 45 | 4e 20 38 31 0d 0a 0d 0a |e MAX_LE|N 81....|
|000000e0| 63 6c 61 73 73 20 70 65 | 72 73 6f 6e 20 7b 0d 0a |class pe|rson {..|
|000000f0| 70 72 6f 74 65 63 74 65 | 64 3a 0d 0a 20 20 20 20 |protecte|d:.. |
|00000100| 63 68 61 72 20 66 6e 61 | 6d 65 5b 4d 41 58 5f 4c |char fna|me[MAX_L|
|00000110| 45 4e 5d 3b 0d 0a 20 20 | 20 20 63 68 61 72 20 6c |EN];.. | char l|
|00000120| 6e 61 6d 65 5b 4d 41 58 | 5f 4c 45 4e 5d 3b 0d 0a |name[MAX|_LEN];..|
|00000130| 20 20 20 20 69 6e 74 20 | 20 61 67 65 3b 0d 0a 70 | int | age;..p|
|00000140| 75 62 6c 69 63 3a 0d 0a | 20 20 20 20 76 6f 69 64 |ublic:..| void|
|00000150| 20 73 65 74 5f 66 6e 61 | 6d 65 28 63 68 61 72 20 | set_fna|me(char |
|00000160| 66 6e 5b 5d 20 29 20 7b | 20 73 74 72 63 70 79 28 |fn[] ) {| strcpy(|
|00000170| 66 6e 61 6d 65 2c 20 66 | 6e 29 3b 20 7d 3b 0d 0a |fname, f|n); };..|
|00000180| 20 20 20 20 76 6f 69 64 | 20 73 65 74 5f 6c 6e 61 | void| set_lna|
|00000190| 6d 65 28 63 68 61 72 20 | 6c 6e 5b 5d 20 29 20 7b |me(char |ln[] ) {|
|000001a0| 20 73 74 72 63 70 79 28 | 6c 6e 61 6d 65 2c 20 6c | strcpy(|lname, l|
|000001b0| 6e 29 3b 20 7d 3b 0d 0a | 20 20 20 20 76 6f 69 64 |n); };..| void|
|000001c0| 20 73 65 74 5f 61 67 65 | 28 20 69 6e 74 20 61 20 | set_age|( int a |
|000001d0| 29 20 7b 20 61 67 65 20 | 3d 20 61 20 3b 20 7d 3b |) { age |= a ; };|
|000001e0| 0d 0a 20 20 20 20 63 68 | 61 72 20 2a 67 65 74 5f |.. ch|ar *get_|
|000001f0| 6e 61 6d 65 28 63 68 61 | 72 20 2a 66 75 6c 6c 6e |name(cha|r *fulln|
|00000200| 61 6d 65 29 3b 0d 0a 20 | 20 20 20 69 6e 74 20 20 |ame);.. | int |
|00000210| 67 65 74 5f 61 67 65 28 | 20 76 6f 69 64 20 29 20 |get_age(| void ) |
|00000220| 7b 20 72 65 74 75 72 6e | 20 61 67 65 3b 20 7d 3b |{ return| age; };|
|00000230| 0d 0a 20 20 20 20 70 65 | 72 73 6f 6e 28 63 68 61 |.. pe|rson(cha|
|00000240| 72 20 66 6e 5b 5d 20 3d | 20 22 62 6c 61 6e 6b 22 |r fn[] =| "blank"|
|00000250| 2c 20 63 68 61 72 20 6c | 6e 5b 5d 20 3d 20 22 62 |, char l|n[] = "b|
|00000260| 6c 61 6e 6b 22 29 3b 0d | 0a 7d 3b 0d 0a 0d 0a 63 |lank");.|.};....c|
|00000270| 6c 61 73 73 20 65 6d 70 | 6c 6f 79 65 65 20 3a 20 |lass emp|loyee : |
|00000280| 70 75 62 6c 69 63 20 70 | 65 72 73 6f 6e 20 7b 0d |public p|erson {.|
|00000290| 0a 70 72 6f 74 65 63 74 | 65 64 3a 0d 0a 20 20 20 |.protect|ed:.. |
|000002a0| 20 6c 6f 6e 67 20 73 61 | 6c 61 72 79 3b 0d 0a 70 | long sa|lary;..p|
|000002b0| 75 62 6c 69 63 3a 0d 0a | 20 20 20 20 76 6f 69 64 |ublic:..| void|
|000002c0| 20 73 65 74 5f 73 61 6c | 61 72 79 28 6c 6f 6e 67 | set_sal|ary(long|
|000002d0| 20 73 61 6c 29 20 7b 20 | 73 61 6c 61 72 79 20 3d | sal) { |salary =|
|000002e0| 20 73 61 6c 3b 20 7d 3b | 0d 0a 20 20 20 20 6c 6f | sal; };|.. lo|
|000002f0| 6e 67 20 67 65 74 5f 73 | 61 6c 61 72 79 28 29 20 |ng get_s|alary() |
|00000300| 7b 20 72 65 74 75 72 6e | 20 73 61 6c 61 72 79 3b |{ return| salary;|
|00000310| 20 7d 3b 0d 0a 20 20 20 | 20 65 6d 70 6c 6f 79 65 | };.. | employe|
|00000320| 65 28 63 68 61 72 20 66 | 6e 5b 5d 20 3d 20 22 65 |e(char f|n[] = "e|
|00000330| 62 6c 61 6e 6b 22 2c 20 | 63 68 61 72 20 6c 6e 5b |blank", |char ln[|
|00000340| 5d 20 3d 20 22 65 62 6c | 61 6e 6b 22 29 3b 0d 0a |] = "ebl|ank");..|
|00000350| 7d 3b 0d 0a 0d 0a 70 65 | 72 73 6f 6e 3a 3a 70 65 |};....pe|rson::pe|
|00000360| 72 73 6f 6e 28 20 63 68 | 61 72 20 66 6e 5b 5d 2c |rson( ch|ar fn[],|
|00000370| 20 63 68 61 72 20 6c 6e | 5b 5d 20 29 0d 0a 7b 0d | char ln|[] )..{.|
|00000380| 0a 20 20 20 20 73 74 72 | 63 70 79 28 66 6e 61 6d |. str|cpy(fnam|
|00000390| 65 2c 20 66 6e 29 3b 0d | 0a 20 20 20 20 73 74 72 |e, fn);.|. str|
|000003a0| 63 70 79 28 6c 6e 61 6d | 65 2c 20 6c 6e 29 3b 0d |cpy(lnam|e, ln);.|
|000003b0| 0a 20 20 20 20 61 67 65 | 20 3d 20 2d 31 3b 0d 0a |. age| = -1;..|
|000003c0| 7d 0d 0a 0d 0a 63 68 61 | 72 20 2a 70 65 72 73 6f |}....cha|r *perso|
|000003d0| 6e 3a 3a 67 65 74 5f 6e | 61 6d 65 28 63 68 61 72 |n::get_n|ame(char|
|000003e0| 20 66 75 6c 6c 6e 61 6d | 65 5b 5d 29 0d 0a 7b 0d | fullnam|e[])..{.|
|000003f0| 0a 20 20 20 20 73 74 72 | 63 70 79 28 66 75 6c 6c |. str|cpy(full|
|00000400| 6e 61 6d 65 2c 20 66 6e | 61 6d 65 29 3b 0d 0a 20 |name, fn|ame);.. |
|00000410| 20 20 20 73 74 72 63 61 | 74 28 66 75 6c 6c 6e 61 | strca|t(fullna|
|00000420| 6d 65 2c 20 22 20 22 29 | 3b 0d 0a 20 20 20 20 73 |me, " ")|;.. s|
|00000430| 74 72 63 61 74 28 66 75 | 6c 6c 6e 61 6d 65 2c 20 |trcat(fu|llname, |
|00000440| 6c 6e 61 6d 65 29 3b 0d | 0a 0d 0a 20 20 20 20 72 |lname);.|... r|
|00000450| 65 74 75 72 6e 20 66 75 | 6c 6c 6e 61 6d 65 3b 0d |eturn fu|llname;.|
|00000460| 0a 7d 0d 0a 0d 0a 65 6d | 70 6c 6f 79 65 65 3a 3a |.}....em|ployee::|
|00000470| 65 6d 70 6c 6f 79 65 65 | 28 20 63 68 61 72 20 66 |employee|( char f|
|00000480| 6e 5b 5d 2c 20 63 68 61 | 72 20 6c 6e 5b 5d 20 29 |n[], cha|r ln[] )|
|00000490| 20 3a 20 70 65 72 73 6f | 6e 28 66 6e 2c 20 6c 6e | : perso|n(fn, ln|
|000004a0| 29 0d 0a 7b 0d 0a 20 20 | 20 20 73 61 6c 61 72 79 |)..{.. | salary|
|000004b0| 20 3d 20 30 3b 0d 0a 7d | 0d 0a 0d 0a 0d 0a 69 6e | = 0;..}|......in|
|000004c0| 74 20 6d 61 69 6e 28 69 | 6e 74 20 61 72 67 63 2c |t main(i|nt argc,|
|000004d0| 20 63 68 61 72 2a 20 61 | 72 67 76 5b 5d 29 0d 0a | char* a|rgv[])..|
|000004e0| 7b 0d 0a 20 20 20 20 63 | 68 61 72 20 66 75 6c 6c |{.. c|har full|
|000004f0| 5b 4d 41 58 5f 4c 45 4e | 20 2b 20 4d 41 58 5f 4c |[MAX_LEN| + MAX_L|
|00000500| 45 4e 5d 3b 0d 0a 0d 0a | 20 20 20 20 70 65 72 73 |EN];....| pers|
|00000510| 6f 6e 20 62 72 61 64 28 | 22 42 72 61 64 6c 65 79 |on brad(|"Bradley|
|00000520| 22 2c 20 22 4a 6f 6e 65 | 73 22 29 3b 0d 0a 20 20 |", "Jone|s");.. |
|00000530| 20 20 62 72 61 64 2e 73 | 65 74 5f 61 67 65 28 32 | brad.s|et_age(2|
|00000540| 31 29 3b 0d 0a 0d 0a 20 | 20 20 20 70 65 72 73 6f |1);.... | perso|
|00000550| 6e 20 62 6c 61 6e 6b 3b | 0d 0a 0d 0a 20 20 20 20 |n blank;|.... |
|00000560| 63 6f 75 74 20 3c 3c 20 | 22 5c 6e 50 65 72 73 6f |cout << |"\nPerso|
|00000570| 6e 20 62 72 61 64 3a 20 | 20 22 20 3c 3c 20 62 72 |n brad: | " << br|
|00000580| 61 64 2e 67 65 74 5f 6e | 61 6d 65 28 66 75 6c 6c |ad.get_n|ame(full|
|00000590| 29 3b 0d 0a 20 20 20 20 | 63 6f 75 74 20 3c 3c 20 |);.. |cout << |
|000005a0| 22 5c 6e 20 20 20 20 20 | 20 20 20 61 67 65 3a 20 |"\n | age: |
|000005b0| 20 22 20 3c 3c 20 62 72 | 61 64 2e 67 65 74 5f 61 | " << br|ad.get_a|
|000005c0| 67 65 28 29 3b 0d 0a 0d | 0a 20 20 20 20 63 6f 75 |ge();...|. cou|
|000005d0| 74 20 3c 3c 20 22 5c 6e | 50 65 72 73 6f 6e 20 62 |t << "\n|Person b|
|000005e0| 6c 61 6e 6b 3a 20 22 20 | 3c 3c 20 62 6c 61 6e 6b |lank: " |<< blank|
|000005f0| 2e 67 65 74 5f 6e 61 6d | 65 28 66 75 6c 6c 29 3b |.get_nam|e(full);|
|00000600| 0d 0a 20 20 20 20 63 6f | 75 74 20 3c 3c 20 22 5c |.. co|ut << "\|
|00000610| 6e 20 20 20 20 20 20 20 | 20 20 61 67 65 3a 20 22 |n | age: "|
|00000620| 20 3c 3c 20 62 6c 61 6e | 6b 2e 67 65 74 5f 61 67 | << blan|k.get_ag|
|00000630| 65 28 29 3b 0d 0a 20 20 | 20 20 63 6f 75 74 20 3c |e();.. | cout <|
|00000640| 3c 20 22 5c 6e 22 3b 0d | 0a 0d 0a 20 20 20 20 65 |< "\n";.|... e|
|00000650| 6d 70 6c 6f 79 65 65 20 | 6b 79 6c 65 28 20 22 4b |mployee |kyle( "K|
|00000660| 79 6c 65 22 2c 20 22 52 | 69 6e 6e 65 22 20 29 3b |yle", "R|inne" );|
|00000670| 0d 0a 20 20 20 20 6b 79 | 6c 65 2e 73 65 74 5f 73 |.. ky|le.set_s|
|00000680| 61 6c 61 72 79 28 20 35 | 30 30 30 30 20 29 3b 0d |alary( 5|0000 );.|
|00000690| 0a 20 20 20 20 6b 79 6c | 65 2e 73 65 74 5f 61 67 |. kyl|e.set_ag|
|000006a0| 65 28 33 32 29 3b 0d 0a | 0d 0a 20 20 20 20 63 6f |e(32);..|.. co|
|000006b0| 75 74 20 3c 3c 20 22 5c | 6e 45 6d 70 6c 6f 79 65 |ut << "\|nEmploye|
|000006c0| 65 20 6b 79 6c 65 3a 20 | 22 20 3c 3c 20 6b 79 6c |e kyle: |" << kyl|
|000006d0| 65 2e 67 65 74 5f 6e 61 | 6d 65 28 66 75 6c 6c 29 |e.get_na|me(full)|
|000006e0| 3b 0d 0a 20 20 20 20 63 | 6f 75 74 20 3c 3c 20 22 |;.. c|out << "|
|000006f0| 5c 6e 20 20 20 20 20 20 | 20 20 20 20 61 67 65 3a |\n | age:|
|00000700| 20 22 20 3c 3c 20 6b 79 | 6c 65 2e 67 65 74 5f 61 | " << ky|le.get_a|
|00000710| 67 65 28 29 3b 0d 0a 20 | 20 20 20 63 6f 75 74 20 |ge();.. | cout |
|00000720| 3c 3c 20 22 5c 6e 20 20 | 20 20 20 20 20 73 61 6c |<< "\n | sal|
|00000730| 61 72 79 3a 20 22 20 3c | 3c 20 6b 79 6c 65 2e 67 |ary: " <|< kyle.g|
|00000740| 65 74 5f 73 61 6c 61 72 | 79 28 29 3b 0d 0a 20 20 |et_salar|y();.. |
|00000750| 20 20 63 6f 75 74 20 3c | 3c 20 22 5c 6e 5c 6e 22 | cout <|< "\n\n"|
|00000760| 3b 0d 0a 0d 0a 20 20 20 | 20 72 65 74 75 72 6e 20 |;.... | return |
|00000770| 30 3b 0d 0a 7d 0d 0a 0d | 0a 00 00 00 00 00 00 00 |0;..}...|........|
|00000780| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000790| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|000007a0| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|000007b0| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|000007c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000800| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000870| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000880| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000890| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|000008a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+