Declare a variable A instead of B , continuing to use constructor B
A objectB = new B(); int result=objectB.Sum(7);
This will use method A This is true only because the method is obscured and not overridden.
You will also receive a compiler warning for your Sum method in B , and you can define it as public new int Sum(int i) to signal that the hide is intended.
source share