lundi 1 août 2016

Can you please tell me why am i getting the error that courseList_ is private

This is error and i donot know why am i getting the same error in the scmApp() constructor

ScmTester.cpp:19:5: error: within this context
ScmApp.h:10:34: error: âsict::Course* sict::ScmApp::courseList_ [2000]â is private
ScmTester.cpp:20:5: error: within this context
ScmApp.h:10:34: error: âsict::Course* sict::ScmApp::courseList_ [2000]â is private

this is .h file

#ifndef SICT_SCAMAPP_H__ #define SICT_SCAMAPP_H__ #include "Course.h"

namespace sict {

class ScmApp : public Course {
private:
    Course* courseList_[MAX_NO_RECS];
    int noOfCourses_ = 0;


    int pause()const;
    int menu();
    void listCourses()const;
    int searchForACourse(const char* courseCode)const;
    void changeStudyLoad(const char* courseCode);
    void addACourse();
public:
    ScmApp();
    int run();
};



}
#endif

this is .cpp part where i am getting error

#include "ScmApp.h"
using namespace std;

namespace sict {

void clear(void)
{
    while (getchar() != '\n');    //clears buffer
}


ScmApp::ScmApp(){           //no argument constructor
    for (int i = 0; i < MAX_NO_RECS; i++)
        this->courseList_[i] = nullptr;
    noOfCourses_ = 0;
}

Aucun commentaire:

Enregistrer un commentaire