我有闲置的头文件。我收到此错误:expected ')' before 'A'
这是为什么?我试图重写和替换......我没有想法,我不知道问题的根源是什么......
#ifndef UICONSOLE_H_
#define UICONSOLE_H_
#include "Catalog.h"
#include <string>
using namespace std;
class UIconsole{
public:
UIconsole(Catalog A); // error here.
void runUI();
private:
void showMenu();
string getString();
int getOption();
void addStudent();
void removeStudent();
void editStudent();
void printStudent();
void printAllStudents();
void addAssignment();
void removeAssignment();
void editAssignment();
void printAssignment();
void printAllAssignment();
void printAllUnder5();
void sortAlphabetically();
void searchById();
};
#endif /* UICONSOLE_H_ */
使用依赖标头的内容进行编辑:
#ifndef CATALOG_H_
#define CATALOG_H_
#include <string>
#include "UIconsole.h"
#include "Catalog.h"
#include "StudentRepository.h"
#include "StudentValidator.h"
using namespace std;
class Catalog{
private:
StudentRepository studRepo;
StudentValidator studValid;
public:
Catalog(StudentRepository stre, StudentValidator stva):studRepo(stre),studValid(stva){};
void addNewStudent(string name, int id, int group);
void removeStudent(string name);
void editStudent(int name, int id, int group);
Student seachStudent(string name);
};
#endif /* CATALOG_H_ */