Evyatar12

Student

Nov 28th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Nodes
  8. {
  9. class Student
  10. {
  11. public int ID { get; }
  12.  
  13. private Node<Subject> subjects;
  14.  
  15. public Student(int ID, Node<Subject> subjects)
  16. {
  17. this.ID = ID;
  18. this.subjects = subjects;
  19. }
  20.  
  21. public Node<Subject> getSubjects()
  22. {
  23. return this.subjects;
  24. }
  25.  
  26. private Node<Subject> current;
  27.  
  28. public void addSubject(Subject subject)
  29. {
  30. Node<Subject> t = new Node<Subject>(subject);
  31.  
  32. if (this.subjects == null)
  33. {
  34. this.subjects = t;
  35.  
  36. }
  37. else
  38. {
  39. this.current.setNext(t);
  40. }
  41.  
  42. this.current = t;
  43. }
  44. }
  45. }
Add Comment
Please, Sign In to add comment