【发布时间】:2012-10-11 21:49:20
【问题描述】:
尝试构建包含以下代码的 c++ 程序时:
menutype::menutype(int cat_num){
extras list = extras(cat_num);
}
extras::extras(int num_cats){
head = new category_node;
head->next = NULL;
head->category = 1;
category_node * temp;
for(int i = 1; i < (num_cats); ++i){
temp = new category_node;
temp->next = head->next;
head->next = temp;
temp->category = (num_cats-(i-1));
}
}
我收到错误:
cs163hw1.cpp:在构造函数“menutype::menutype(int)”中:
cs163hw1.cpp:59:31: 错误: 没有匹配的函数调用'extras::extras()'
cs163hw1.cpp:59:31:注意:候选人是:
cs163hw1.cpp:5:1: 注意: extras::extras(int)
我不明白为什么,请帮忙!
【问题讨论】:
标签: c++ class object constructor