《C++ Primer Plus(第6版)》14章 C++代码复用 - 代码清单14.3

学习C++类代码复用,将代码清单14.3

1 Student ada[pupils] =
 { Student(quizzes),Student(quizzes) ,Student(quizzes)};

修改为

2 Student ada[pupils] =
 { Student[quizzes],Student[quizzes] ,Student[quizzes]};

出现的错误图中所示:

1 表示Student ada 3(pupils)个对象,每个对象均为Student(quizzes),调用explicit Student(const std::string & s) :name("Nully"), scores() {}???还是

explicit Student(int n) :name("Nully"), scores() {}

2 表示Student ada 3(pupils)个对象,每个对象均为Student[quizzes],对象重复包含;

2019/6/18

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

posted @ 2019-06-18 14:41  合滨  阅读(235)  评论(0编辑  收藏  举报