a case for multiple inheritance



Hi All,
Although C# has Generics, it still does not support the generic programming paradigm. Multiple inheritance is required to support real generic programming. Here is a simple design pattern to illustrate this.

Problem:
I need to expose two lists of objects from a high-level class. I would like to expose these lists as read-only, but require write access internally.

Solution:
1) Create a generic ProtectedList<T> class which inherits from List<T> and overrides the write functions (using the new modifier) to change the access level from public to protected.
2) Inherit both specialized List<T> by the high-level class

Discussion:
While this usage of inheritance does not conform to the "is-a" relation imposed by the OOP paradigm, it is a simple and easy way to reuse code in a generic way.

Thanks for any thoughts, and good solutions to this problem in the existing C# paradigm.
.



Relevant Pages

  • Re: The Language I want
    ... It has nothing to do with inheritance. ... The point is that visibility belongs to package / module. ... Generics is a huge mess. ... Yes it does it protects members from access by users, ...
    (comp.lang.misc)
  • Re: a case for multiple inheritance
    ... Although C# has Generics, it still does not support the generic programming paradigm. ... Multiple inheritance is required to support real generic programming. ... While this usage of inheritance does not conform to the "is-a" relation imposed by the OOP paradigm, it is a simple and easy way to reuse code in a generic way. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: The Language I want
    ... It has nothing to do with inheritance. ... The point is that visibility belongs to package / module. ... Generics is a huge mess. ... Yes it does it protects members from access by users, ...
    (comp.lang.misc)
  • Re: The Language I want
    ... inheritance of interfaces from concrete types. ... Generics is a huge mess. ... Templates or hygenic macros are not generics! ...
    (comp.lang.misc)
  • Re: a case for multiple inheritance
    ... Although C# has Generics, it still does not support the generic ... I need to expose two lists of objects from a high-level class. ... While this usage of inheritance does not conform to the "is-a" relation ... private new void Foo ...
    (microsoft.public.dotnet.languages.csharp)