trying to make this college assignment with multiple inheritance. Here is the Student class, that is supposed to use MI:
#include "Person.h"
#include "Studying.h"
#include "StudentRoll.h"
class Student : public Person, public Studying {
private:
int mathScore;
public:
Student(string n,int b,int i,int c,double a):Person(n,b),Studying(i,c,a){}
string toString();
friend class StudentRoll;
};
And here are its ancestors:
#include <string>
using namespace std;
class Person {
private:
string name;
int birthYear;
public:
Person() :name(""), birthYear(1900){}
Person(string n, int y);
void setBirthYear(int y);
string toString();
};
using namespace std;
class Studying {
private:
int id;
int course;
double average;
public:
Studying():id(0),course(1),average(3.0){}
Studying(int i, int c, double a):id(i),course(c),average(a){}
void setCourse(int c);
string toString();
};
I get some weird errors with the following class
#pragma once
#include "Student.h"
#include <vector>
#include <iostream>
using namespace std;
class StudentRoll {
private:
vector<Student> students;
public:
void push(Student s);
void pop();
void show();
};
And here are the errors:
Severity Code Description Project File Line Error C2923 'std::vector': 'Student' is not a valid template type argument for parameter '_Ty' lab3 i:\onedrive\uni\oop\lab3\lab3\studentroll.h 10
Severity Code Description Project File Line Error C3867 'std::vector>::size': non-standard syntax; use '&' to create a pointer to member lab3 i:\onedrive\uni\oop\lab3\lab3\studentroll.cpp 17
Severity Code Description Project File Line Error C2065 'Student': undeclared identifier lab3 i:\onedrive\uni\oop\lab3\lab3\studentroll.h 10
Severity Code Description Project File Line Error C2248 'Student::mathScore': cannot access private member declared in class 'Student' lab3 i:\onedrive\uni\oop\lab3\lab3\studentroll.cpp 22
Severity Code Description Project File Line Error C2061 syntax error: identifier 'Student' lab3 i:\onedrive\uni\oop\lab3\lab3\studentroll.h 12
I can include cpps in case they are necessary. Please, help