The issue is your List cannot take something of two types, and with the way you have this setup, Your list is only dealing with one or the other type. So in your case you pass in IMyConcreteClass to your list well IMyConcreteClass does not have an impl of Name so when you pass those objects around its not going to display the name... if you passed in MyBaseClass to the list you will just get the name and not the description why because MyBaseClass does not provide an impl for description it knows nothing about it. So when you pass in MyConcreteClass and it works its because it provides an impl for both name and description.dami said:You mean I should override the propertys on the concrete interface?wacko said:*snip*
But the MyConcreteClass inherits the name property from MyBaseClass, the same way as IMyConcreteClass does from IMyBaseClass... does interface inheritance work like this or i'm wrong? :-/
thanks for your reply!
This is really a flaw in your design, I do not see a reason why you have all these interfaces and abstract classes. I think that MyConcreteClass should just impl both interfaces and you would be find and then just pass MyConcreteClass as the list type. Or have the Abstract class impl both interfaces and then have MyConcreteClass inherit from that and then pass in MyBaseClass to the list.