前言 最近在学习C++,又重温了一遍面向对象,发现一些我以前没有注意到的点private修饰的字段可以在该类的public方法中使用 class Student { string name; int score; int id; public bool CompareScore( Student stu) { return stu.score > this.score; } }