// SeparatedClass - this doesn't compile properly #include #include #include "student.h" double fn(Student& fs) { // since calcTuition() is declared virtual this // call uses the run time type of fs to resolve // the call return fs.calcTuition(); } int main(int nArgc, char* pszArgs[]) { // the following expression calls // fn() with a Student object Student s; cout << "The value of s.calcTuition when\n" << "called virtually through fn() is " << fn(s) << "\n\n"; // the following expression calls // fn() with a GraduateStudent object GraduateStudent gs; cout << "The value of gs.calcTuition when\n" << "called virtually through fn() is " << fn(gs) << "\n\n"; return 0; }