知識點
重載
各種函數(shù)重載
自定義sort函數(shù)
1.元素重載>/<號
2.函數(shù)類型為:
static bool cmp(const Student& a, const Student& b);
bool StudentCollection::cmp(const Student &a, const Student &b){
return a>b;
}
3.被卡是因為什么呢
最開始定義的sc類型為Student**
這種時候直接調(diào)用sort當(dāng)然不行
因此應(yīng)該把sc改成vector<Student>這樣就能用了