~ Synatx header file (with parenthesis request)

I have a header file header. I get this error: expected ')' before 'A'why is this? I tried to rewrite and replace ... I am not aware of the ideas, and I do not know what could be causing the problem ...

#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_ */

change, with the contents of the dependency header:

#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_ */
+3
source share
2 answers

There Catalog.hare several unnecessary directives in your file #include:

#include "UIconsole.h"
#include "Catalog.h"

Get rid of them from a specific file.

#include "Catalog.h"not needed, but harmless (due to the inclusion of guards). However, it #include "UIconsole.h"calls the ad class UIconsolefor processing before the ad class Catalog. Therefore, when the compiler gets into

UIconsole(Catalog A);

the string still doesn't know what it is Catalog.

, , , -

using namespace std;

. , - std:

void addNewStudent(std::string name, int id, int group);
void removeStudent(std::string name);

( , , ).

+3

: , , , . , .

, :

:

  • .
  • Console.h
  • Catalog.h, - .
  • Console.h, Catalog.

. . include UIconsole.h Catalog.h, .

0

All Articles