class myItem {
int key;
string name;
public:
// Constructor
myItem(int key, string name)
{
key = key;
name = name;
}
};
class myCollection {
vector<myItem> col;
public:
void insert(myItem &i);
void print();
};
int main() {
myCollection c;
int key;
string name;
cin >> key;
cin >> name;
myItem i = myItem(key, name);
c.insert(i);
c.print();
}
When I try to compile this, I get the error: no matching function for call to ‘myItem::myItem()’ and note: candidate: myItem::myItem(int, std::string). candidate expects 2 arguments, 0 provided. How might I fix this? Thanks!