Oct 31, 2014 at 12:20pm
expected class-name before '{' token
here is the class:
#ifndef STUDENT_H_INCLUDED
#define STUDENT_H_INCLUDED
#include "TA.h"
#include <iostream>
#include <string>
#include <fstream>
#include <cstring>
#include <cmath>
using namespace std;
struct Courses
{
string code, title;
int credit, mark;
};
class student
{
private:
string ID, name;
int numberOfCourses;
double GPA;
Courses coursesTaken[10];
public:
void set(ifstream& , string , string , int);
float getGPA()const;
void calculateGPA();
void print()const;
student();
student(ifstream& , string, string, int);
};
#endif // STUDENT_H_INCLUDED
-----------------------------------------------
here is the derived class:
#ifndef TA_H_INCLUDED
#define TA_H_INCLUDED
#include "Student.h"
using namespace std;
class TA: public student
{
private:
string department;
float rating, salary;
int numberOfHours;
public:
float calculateSalary();
void set(string, int, float);
float getSalary();
void print();
TA(string = "name", int = 0, float = 0);
};
#endif // TA_H_INCLUDED
--------------------------------------------
whats the problem plz answer me.
Oct 31, 2014 at 12:23pm
Your compiler will have told you what line that error was occurring on. Is there any reason you've decided not to share that information with us?
EDIT: Also, please use code tags to make your code more readable:
http://www.cplusplus.com/articles/z13hAqkS/
Also, you haven't shown us the code that actually uses those header files.
Last edited on Oct 31, 2014 at 12:26pm
Oct 31, 2014 at 12:31pm
Why are you doing reference to TA.h in Student.h???
You only need put @include in your derived class...
Oct 31, 2014 at 12:48pm
the error was after the inherited class <class TA: public student> right before the curly bracket.
and sorry that i posted the code like that im new here and have been tryin to figgure it out............now that u mentioned it thanx :D
Oct 31, 2014 at 1:00pm
Ty lazaro and mike for your time i solved the problem.........i removed #include "TA.h" from the student header and now the program is working fine :D