G
Guest
Does c# support overriding by name and not signature
For instance I am building a custom collection class, that ca
only take a certain type of object
For this, I have added an override for add from the class view
and changed it fro
public int Add(object value
t
public int Add(MyItemClass value
This seems to work, but it generates a warning 'the new specifier is needed
because this method hides ...[that of the base class].
But even though I didn't think this would work to override the base clas
because it's not the same signature, it does, and apart from the warning, thi
is what I want to happen. But can a client still call the Add method from the bas
class, or is it totally overridden just by being called Add (i.e. doesn't need the sam
signature as the base class's method to override it)
For instance I am building a custom collection class, that ca
only take a certain type of object
For this, I have added an override for add from the class view
and changed it fro
public int Add(object value
t
public int Add(MyItemClass value
This seems to work, but it generates a warning 'the new specifier is needed
because this method hides ...[that of the base class].
But even though I didn't think this would work to override the base clas
because it's not the same signature, it does, and apart from the warning, thi
is what I want to happen. But can a client still call the Add method from the bas
class, or is it totally overridden just by being called Add (i.e. doesn't need the sam
signature as the base class's method to override it)