dimanche 17 janvier 2021

Passing vector as a constructor parameter [closed]

I'm currently having trouble passing in a vector to a constructor. The constructor needs to take 3 inputs, 2 of which are strings. However, when I try to pass in a string of characters, it comes out with an error. I don't really know why, so any help would be appreciated.

class FileRead {
private:
string file, input;
vector<string> vec;
public:

FileRead()
{
    file = "no file";
    input = "no input";
}

FileRead(const string& f, string i, vector<string> v)
{
    file = f;
    input = i;
    vec = v;
}
};

int main()
{
FileRead rFile("hello", string hob, vector<string> hobbit)
}

Aucun commentaire:

Enregistrer un commentaire