Newcomer to C++ and I have created an enum for 'degree' with 3 types 'SECURITY, NETWORKING, SOFTWARE' that are returning a type error when the subclass is attempting to use the enum. What type is it specifically looking for?
//Network Student Subclass
#include <string>
#include "degree.h"
#include "student.h"
class NetworkStudent : public Student //This class derives from Student
{
public:
NetworkStudent();
NetworkStudent(
string student_id,
string first_name,
string last_name,
string email,
double age,
double* days,
degree type
);
degree getdegree();
void setdegree(degree d);
void print();
~NetworkStudent();
};
//Enum with 3 Types
#include <string>
//The three types of degrees available
enum degree {SECURITY,NETWORKING,SOFTWARE};
static const std::string degreeTypeStrings[] = { "SECURITY","NETWORKING", "SOFTWARE" };
//Network Student definition with invalid type error for NETWORKING
#include "student.h"
#include "networkStudent.h"
using std::cout;
NetworkStudent::NetworkStudent()
{
//Right here is where I get the error on NETWORKING
setdegree(NETWORKING);
}
Error states: argument of type "degree" is incompatible with parameter of type "degree". I thought degree was an enum and NETWORKING was also an enum.