I have a class and I want one of the class functions to take in a vector and return a different vector. I tried something like this but I get errors at the function declaration and definition saying that they don't match.
error messages:
setsP4.cpp:286:26: error: prototype for ‘const std::vector<int>& SetParallel::checkElements(std::vector<double>&)’ does not match any in class ‘SetParallel’
std::vector<int> const & SetParallel::checkElements(std::vector<double> & vec
^
setsP4.cpp:68:30: error: candidate is: const std::vector<int>& SetParallel::checkElements(const std::vector<double>&)
std::vector<int> const & checkElements(const std::vector<double> & );
example:
class myClass{
public:
std::vector<int> myFunction(const std::vector<double> & );
};
std::vector<int> myClass::myFunction(const std::vector<double> & myVect){
std::vector<int> results;
//do stuff with results;
return results;
}
Aucun commentaire:
Enregistrer un commentaire