小编Ati*_*tif的帖子

根据输入调用不同类的构造函数

我有一个名为Masterdocument的类,它包含不同的进程.每个流程包含不同数量的问题和每个问题的可能答案选项.每个答案选项的权重也在文档中提到.根据用户提供的答案,查阅主文档并对用户响应进行评分.示例代码如下所示.

Class Masterdocument {
vector <MasterProcess>;
}; 
Class MasterProcess1 { 
id = 10;
num of questions = 2;
question1;
answer1option1;
answer1option2;
question1Weightage;

question2;
answer2option1;
answer2option2;
question2weightage;

//constructor
MasterProcess1(){
question1 =1;
answer1option1 =1;
answer1 option2 = 2;
question1weightage = 0.1

question2 =2;
answer2option1 = 1;
answer2option2 = 2;
question2weightage = 0.2;
}
};

Class MasterProcess2 {
id  =11; 
num of questions = 3;
question1;
answer1option1;
answer1option2;
question1Weightage;

question2;
answer2option1;
answer2option2;
answer2option3;
question2weightage;

question3;
answer3option1;
answer3option2;
question3weightage;

//constructor
MasterProcess2(){
question1 =1;
answer1option1 …
Run Code Online (Sandbox Code Playgroud)

c++ constructor overloading

5
推荐指数
1
解决办法
511
查看次数

标签 统计

c++ ×1

constructor ×1

overloading ×1