Consider the following classes:
public class A
{
}
public class B
{
public static A StaticA { get; set; }
}
public class C : B
{
public static A StaticA { get; set; }
}
This will throw a warning:
'C.StaticA' hides inherited member 'B.StaticA'. Use the new keyword if hiding was intended.
I can get rid of the warning by adding the new
keyword as I am told:
public static new A StaticA { get; set; }
But why should I? Why are static members being inherited? As far as I'm concerned static members are bound to a specific type, not an instance.
However, the warning does say "inherited member", so these static properties seem to be in fact inherited.
Why is this? Isn't static inheritance against OOP principles?