I must not have run into this in a long time, as it surprised me.
The compiler wouldn't let me do this...
Type 'MyClass' already defines a member called 'A' with the same parameter types
It surprised me because I would have assumed this was legal. When I thought about why I would have assumed that, it was because I was thinking that the method does have a different implicit signature, i.e. the instance method takes a this pointer, and the static method does not. Why can't the compiler tell the difference between these?
Edit: damn, anyone know how to control the height of the code window?
Code:
public class MyClass
{
[INDENT]public void A(int i) { }[/INDENT]
[INDENT]public static void A(int i){}[/INDENT]
}
The compiler wouldn't let me do this...
Type 'MyClass' already defines a member called 'A' with the same parameter types
It surprised me because I would have assumed this was legal. When I thought about why I would have assumed that, it was because I was thinking that the method does have a different implicit signature, i.e. the instance method takes a this pointer, and the static method does not. Why can't the compiler tell the difference between these?
Edit: damn, anyone know how to control the height of the code window?
Last edited: