C# Override limitation..why?



Why can't I do this in C#

public class A
{
public A virtual whatever( A a )
{
}
}

public class B : A
{
public B override whatever( B b )
{
}
}

Why does the signature of the override have to match exactly the base
version?

It seems like a perfectly safe thing to do so why can't I do it? In
some situations it saves lots of casting with duplicate methods.

Cliff

.



Relevant Pages

  • Re: C# Override limitation..why?
    ... signature to use in all cases. ... // Explicit Interface Implementation ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Warum darf man das: (final =?ISO-8859-15?Q?=FCberschreiben=29?=
    ... public class B extends A { ... The signature of m1 is a subsignature of the ... It is a compile-time error to declare two methods with ... Let be the formal type parameters of M and let be the formal type parameters of N. After renaming each occurrence of a Bi in N's type to Ai the bounds of corresponding type variables and the argument types of M and N are the same. ...
    (de.comp.lang.java)
  • Want to take the path of specific overloaded constructors from derived class up to just one below th
    ... I am calling the class at the bottom, "public class D" from a client app with; ... What I want to happen is for the callee to begin at the bottom of the inheritance chain and call only the constructors ... public Class B with the Token signature. ... Right now the execution path moves correctly into the lowermost class with the ctor that contains the Token method signature. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: C# Override limitation..why?
    ... > Why does the signature of the override have to match exactly the base ... > It seems like a perfectly safe thing to do so why can't I do it? ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: getting used to Java - question about "style"
    ... > "Subclasses may override nonfinal methods and Java will dispatch a call to ... > before executing the derived class constructors. ... > constructor." ... public class B extends A ...
    (comp.lang.java.programmer)

Loading