home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
353_02
/
answers
/
ch07_4.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-19
|
877b
|
31 lines
// Chapter 7 - Programming exercise 4
#ifndef CH07_4_H
#define CH07_4_H
class new_name : public name {
char sex;
public;
// Constructor to set all data to NULL. This will also
// call the name constructor with no parameters.
new_name(void) { sex = ' '; };
// Constructor to set sex to blank and pass the name
// to the parent class via a member initializer.
new_name(char *fn, char *mn, char *ln) :
name(fn, mn, ln) { sex = ' '; };
// This sets the sex to the input value, if it is either
// 'M' or 'F', otherwise it leaves it blank and returns
// an error value of zero.
int set_sex(char input_sex);
// This retrieves the value stored
char get_sex(void) { return sex; };
};
#endif