List of interfaces from List of implementation class
I have the following code:
List<MassEditionObject> objects = getProjects();
where MassEditionObject is an interface that is implemented by the Project
class.
getProjects() returns List<Project>, which seems like it should be fine
because Project is a MassEditionObject.
However, Eclipse is giving me this error: Type mismatch: cannot convert
from List<Project> to List<MassEditionObject>
I understand the general idea of interfaces and how to use them, I'm just
not sure why this is invalid.
Thanks, and sorry if this question has been posted. I searched and found
similar situations but none that answered this problem.
No comments:
Post a Comment