On the one hand I have the Subject class:
public class Assignatura{
private int codi;
private Assignatura seguent;
public Assignatura(int c){
codi=c;
seguent=null;
}
As you can see, the following attribute will point to another subject, in order to have a dynamic structure. The same goes for the Course class:
public class Curs {
private int codi;
private Curs seguent;
public Curs(int c, llista_assignatura_curs ll){
codi=c;
seguent=null;
}
My goal now is that a course has a list of subjects, for this I created the class 'llista_asignatura_curs':
public class llista_assignatura_curs {
private Assignatura primera;
public llista_assignatura_curs(){
primera=null;
}
This class has methods to add and remove subjects from the list. The problem is that now. I need to know how to link a list to a course. Would it be adding an attribute to the class class of the type 'llista_assignatura_curs' the solution? Or is there another better way? Thanks
PS: this would be my proposal, but I think it can be done better
public class Curs {
private int codi;
private Curs seguent;
private llista_assignatura_curs llista;
public Curs(int c, llista_assignatura_curs ll){
codi=c;
seguent=null;
llista= ll;
}
Thanks for the help