c++ using functions within functions -
i new c++ working on project dealing doing different operations sets , 1 of them prints out if set finite. sos object being used stands set of strings , has vector of strings , boolean data members. created function check if set finite , trying call in print function keep getting error saying "no member named "isfinite." heres have, appreciated.
void sos::print() const{ if (m_vos.isfinite() == true){ (int = 0; < m_vos.size(); i++){ cout << m_vos[i]<< endl; } } else{ cout << "complement of:"<< endl; (int = 0; i< m_vos.size(); i++){ cout << m_vos[i]<< endl; } } } bool sos::isfinite() const{ if (isfinite(m_vos.size()){ return true; } return false; }
the problem attempting call sos::isfinite()
on std::vector<std::string>
(m_vos
). std::vector
has no such member. can call sos::isfinite()
on object of type sos
or within sos
function.
fortunately within sos
function, can change code to:
void sos::print() const{ // calls sos::isfinite() if (isfinite() == true){
Comments
Post a Comment