Reputation: 1070
I have two seperate project(Dll).
Project 1: contains abstract classes.
Project 2: specific concrete classes that extends abstract classes in Project 1.
I want my abstract classes to be accessible only in classes that is derived from. normally i will use "protected", but since they are not in the same assembly this can not be used.
What Access Modifiers should Project 1 classes use?
Edit: class definition EX
namespace all.Animals
{
public abstract class Animal
{
...
}
}
Upvotes: 0
Views: 443
Reputation: 1038830
If you want the abstract classes defined in Project1 assembly to be visible only to classes in Project2 assembly then make those classes internal
and then set the [InternalsVisibleTo]
assembly level attribute on Project1.
Bear in mind though that the assemblies that have access to Project1 classes are baked into this Project1 assembly. So if tomorrow you decide that Project3 also needs to access those classes you will need to recompile Project1.
Upvotes: 2