c++ - Class pointer to diffrent .h file -


Hello people, I need your help in working. Therefore, I have the first files and the second is the student and I I want to get the function call, but unfortunately it is not running very well. My receipts do not pass the "Course ** Course" collection and I do not know why not.

Course course

My course .h file

ex> #ifndef _CORSE_H # defined _CORSE_H #include & lt; Iostream & gt; #include "Student.h" class {public: zero init (std :: string getName, int test1, int test2, int exam); Std :: string getName (); Int * getGrades (); Double found phengal (); Private: std :: string _name; Int _exam; Int _test1; Int _test2; }; #endif

My student .h file -

  #ifndef _STUDENT_H #define _STUDENT_H #include & lt; Iostream & gt; #include "Course.h" class student {public: zero init (std :: string name, course ** course, int crsCount); Std :: string getName (); Zero setname (standard :: string name); Double getAvg (); Int getCrsCount (); Course meets ** (); Private: std :: string _name; Course ** courses; Int _crsCount; }; #endif  

My course course -

  course ** student :: getCourses () {return (this-> course); }  

"Course ** problem in hot corus ();" Initialization and also get init function and course **; The ceremony Error C4430: Missing type specifier - int Assumed note: C ++ do not support default-et

< P> You have a spherical dependency - tries to include it in each header, and you end up with a class defined before the other, it gives you errors, because before using its name, you have a type of Must have to announce

Course Student does not rely on , so just remove #include from that file.

The definition of student only uses the indicator for the course , hence it requires 't' to be fully defined. It only needs to know That class is present, so that you can change #include with declaration:

  class course;  

A couple more points:

  • In both the headings & lt; String & gt; std :: string since joining; But & lt; Iostream & gt; not because they do not use any I / O stream;
  • Names starting with an underscore and a capital, such as _CORSE_H , are reserved for you should be removed from underscores.
  • You incorrectly capitalized the last code snippet student .

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -