Reputation: 111
class Staff{
public:
void createTeacher(TeacherRecord tr);
tr.addTeacher();
}
class TeacherRecord{
public:
void addTeacher();
}
The logic to add the teacher will be in the TeacherRecord addTeacher() method. In this scenario a Staff uses the TeacherRecord object to add a new Teacher in to the list. Can this be called as Assocation Relationship?
Upvotes: 0
Views: 86
Reputation: 2151
Theoretically no.According to the definition of association, the class Staff
and the class Teacher
should use each other.So the code should have been something like this:
#include <iostream>
using namespace std;
class TeacherRecord{
public:
void addTeacher(Staff school_staff);
};
class Staff{
public:
void createTeacher(TeacherRecord tr){
tr.addTeacher(this);
}
};
int main(){
return 0;
}
A few references which have helped me in understanding the concept are:
Sorry for my long code.Hope this helps.
Upvotes: 1