I’ve been given a question that says this.
Create the IPeople Interface: Teachers and Students have much in common but some minor differences. Create an interface to expose all commanlity between them. You will need to modify the Teacher and Student partial classes in order for them to implement this interface.
Now I’m not entirely sure what this is telling me to do. Teachers are made up of : TeacherId, FirstName, LasteName, DateOfBirth, AnnualSalary, DepartmentId and Students are made up of : StudentId, FirstName, LastName, DateOfBirth, AverageScore, DepartmentId.
I would guess then that the commanality is FirstName, LastName, DateOfBirth and DepartmentId. Also a Teacher teaches a Course and Student takes a Course.
Now I believe I would need to modify the Partial Class of Teacher and Partial Class of Student to add in the CourseID to the class so that I can also create a link between the two as I need to in a further question show all IPeople on a course. I take it an interface can display common values from two classes to create one list which can then be filtered.
So my question is. Am I getting this right so far? I’ve got no experience of this kind of work. If anyone could point me in the right direction for creating an interface that that would be great. Any example coding or websites.
To satisfy this, all you have to do is create the interface w/ the common properties you’ve identified, then in the partial classes have the two classes implement the interface, e.g.:
where IUniversityPerson is the interface you’ve created. Linking course and so on isn’t in the scope of the question as I read it.