Try to search your question here, if you can't find : Ask Any Question Now ?

C++ classes and vectors

HomeCategory: stackoverflowC++ classes and vectors
Avatarjulie asked 3 months ago

I am confused by this! I keep getting the error message that
addSchool is not declared in the scope && no matching function for call to school::addschool(). I cant see how these arent declared. (I am also new to programming )

School is a class and one of the members of this class is a vector pointer

HEADER FILE

 class school{
    private:
       vector<school *> schools;
     public:
          school();
          void addSchool(school *s);
}

CPP file

void school::addSchool(school *s){

   vector<school *> schools;
   s = new school();
   schools.push_back(s);
   }


MAIN FUNCTION

    school *newSchool = new school();
    school::addSchool(&newSchool);
    delete newSchool;
1 Answers
Best Answer
AvatarFernando answered 3 months ago
Your Answer

5 + 5 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com