You have to do something like this:
interface InterfaceA
{
void MethodA();
}
class ClassA : InterfaceA
{
void InterfaceA.MethodA()
{ MethodB(); }
protected virtual void MethodB()
{
}
}
Often this is a superior approach anyway as the internal method may change signature without changing the interface. Take a more real-word example:
interface IOrderDetails
{
void PlaceOrder();
}
//Sometime later you extend with:
interface IOrderDetails2 : IOrderDetails
{
void PlaceOrder(IUser user);
}
//Implementation
class Order : IOrderDetails, IOrderDetails2
{
static readonly IUser AnonUser;
void IOrderDetails.PlaceOrder()
{ OnPlaceOrder(AnonUser); }
void IOrderDetails2.PlaceOrder(IUser user)
{ OnPlaceOrder(user); }
protected virtual void OnPlaceOrder(IUser user)
{
}
}
Here you can see as the IOrderDetails2 was added we can safely refactor the existing virtual method (thus generating compile-time errors for derivations). Additionally this often allows you to provide common functionality, logging, and exception handling in the base implementation class...