Accessing Member Data
P | N


class person_statistics {

public:

int month_of_birth;

int year_of_birth;

int married;

void initialize_ssn(char *); // function protoype

void show_dob(void) { // inline member function

cout << month_of_birth << "/" << year_of_birth << endl;

};

private:

char ssn[12];

int children;

};

void main(void)

{

person_statistics guzdial, ericson;

guzdial.month_of_birth = 9;

guzdial.year_of_birth = 62;

guzdial.married = 1;

guzdial.children = 1; // DEFECTIVE!!!

guzdial.show_dob();

}


Previous | Next


Last modified at 8/5/97; 12:29:41 PM
Other Links of Interest
College of Computing | EduTech Institute | GVU Center
Mark Guzdial | Papers | CS 2390 Spring '97 Home Page | STABLE | MMC-CaMILE

Slide Master