Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
please see the below code...
C#
public class A{
    public void method1() { }
    public void method2() { }
    public void method3() { }        
    public void method4() { }
}   
public class B:A{}
public class C:A{}

now I want that only method1 and method2 should be accesible when I create the object of class B and same way only method3 and method4 should be accesible when I create the object of class C. what I need to do to achive this scenario??
Posted
v2

1 solution

Please start here:
http://msdn.microsoft.com/en-us/library/ms173121.aspx[^],
http://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx[^].

Better don't give more access than it's really needed. Every public can be replaced with internal if you are using this type only in the same assembly. And so on…

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900