int main(void) { Student *student = new Student("XiaoMing", 12, 99); student->display(); Person *p = (Person *)student; p->display(); delete student; Person *person = new Person("XiaoHua", 11); person->display(); Student *s = (Student *)person; s->display(); delete person; return 0; }
int main(void) { #if 0 Person a(10, "xiao ming"), b(16, "xiao hong"); a.display(); b.display(); a = b; a.display(); Person c = b; c.display(); #endif // Person d; Person d(10, "xiaowu"); d = "xiao wang"; d.display(); d.set_name("xiao Wu"); return 0; }
void StudentGrade::display() { thisStudent.display(); cout << " Grade: " << letter_grade << " (" << test_score << "/" << test_points << ")" << endl; }