inheritance-prevention

Preventing methods from being inherited

I have a base class Foo that is concrete and contains 30 methods which are relevant to its subclasses. Now I've come across a situation that is specific only to the base class,and I want to create a method that cannot be inherited, is this possible? Class Foo { /* ... inheritable methods ... */ /* non-inheritable method */ p...

How to hide (remove) a base class's methods in C#?

The essence of the problem is, given a class hierarchy like this: class A { protected void MethodToExpose() {} protected void MethodToHide(object param) {} } class B : A { new private void MethodToHide(object param) {} protected void NewMethodInB() {} } class C : B { public void DoSomething() ...