i ran into into a problem , i want to have a method(M) in a parent class (A) then B and C extend the class A . in this situation i want method(M) can be accessible by B but not C . any solution?
public class A
{
????? string M()
{
return "Hi there";
}
}
public class B:A
{
}
public class C:A
{
}
B newClassB = new B();
C newClassC = new C();
Console.WriteLine(newClassB.M()); //the correct one
Console.WriteLine(newClassC.M()); //the incorrect one