I am doing a college project and one of the things I need to do is a getter for a vector of strings, I was not sure how I could implement this, but them I found this pretty explanatory answer.
But here is the thing : I need to do this using different files, a header and an cpp file. The signature of the getter in the header goes like this :
vector<string> const &getKeyWords() const;
Meanwhile, this is how I implemented the method :
vector<string> Midia:: const &getKeywords() const { return this->keywords; }
but this implementation is giving me the following compilation error :
Midia.cpp:29:24: error: expected unqualified-id before ‘const’
vector<string> Midia:: const &getKeywords() const { return this->keywords; }
Quick observation : the "const" the compiler is talking about is the first one.
And I just don't know what could be the correct way of implementing this sort of getter. Any help in solving this issue gonna be apreciated.