In a c# course I'm taking, We are creating a program that has two main classes, say Student and Course. Now we want to store the data of which courses each student takes. Our instructor said it was a bad practice to have a List of courses as a property of student. The reason he gave was that if you wanted to store the data in a file for example, you'll have no way of reading it back.
The solution he gave was to have a third entity, say studentAndCourse, which would contain the student and course's ID. So given the student ID,you could find all the courses that he takes by searching the studentAndCourse list. I wondered If this solution is the convention for handling this problem, and if there are other solutions.
I've learnt c++, and I think the same question applies there: How can you use a vector, or a dynamic array, as a class field and still be able to store the data.
I'd be more than happy with an online tutorial, but I didn't know what search words to use. If this question was already asked, kindly close it and give me the links. thank you!