CS202   4- ‹#›
Virtual Friends
nvoid account::statement(ostream &o) {
n  o <<"Account Statement" <<endl;
n  o <<"  name = " <<name <<endl;
n  o <<"  balance = " <<balance <<endl;
n}
nvoid checking::statement(ostream &o) {
n  o <<"Checking ";   account::statement(o);
n  o <<"  charges = " <<charges <<endl;
n}
nvoid student::statement(ostream &o) {
n  o <<"Student ";    checking::statement(o);
n  o <<"  school = " <<school <<endl;
n}
nostream &operator<<(ostream &o, account &a) {
n  a.statement(o);    return (o);
n}
napp: student smith("Kyle smith", 5000, "UT");
n  account &ra(smith);  //reference
n  account* pa(&smith); //pointer
n  cout <<ra <<*pa;    //both use the “student
n  
n