Why the direct base class of a class type must be at least as accessible as the class type itself.

  • Thread starter Thread starter GuYuming
  • Start date Start date
G

GuYuming

Guest
I have a custom base class and custom sub class. When i publish my library, i don't like other people to inherit my base class, i only let them use my custom sub class, because i think the base class design is pre-mature and i may refact it in future.

I want to set the base class to be internal, but compiler give error "Inconsistent accessibility: base class is less accessible than".

I think this is a very common senario, why must be this restriction, any way bypass it?


Restrictions on using accessibility levels - C# Reference

my custom classes is something like what follows:

public partial class SiteMapProviderWithCache<CacheDataType>: SiteMapProviderWithCache, INavigationDimension where CacheDataType:DataForClaim,new()

.....

public sealed class MDNSiteMapProvider:SiteMapProviderWithCache<DataForClaim>
.....

Continue reading...
 
Back
Top