怎么对c++类中对象的元素进行计算?

比如有一个student类,定义stud1.2.3.4.5,怎么计算12345的成绩总和和平均分?

直接都加起来不就好了嘛
sum=stud1.score+stud2.score+....+stud5.score
平均分就是sum/总数