Hi Friends....
Can we declare override method is static and original method is non static ? Please explain ?
Thanks.....
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Feb 2, 2012, 11:06 AM
No, you cannot, the signature of the virtual method must remain the same, only the keyword "virtual" is changed to keyword "override" .
//Base Class
Public Class BaseClass
{
public virtual string Name()
{
return "my name";
}
}
//Derived Class
Public Class DerivedClass
{
public override string Name()
{
return "my name is abcd";
}
}
Thanks
Vineet Kumar SainiPosted Feb 2, 2012, 6:01 PM
Prabhu RajaPosted Feb 2, 2012, 1:33 PM
No, We can't do this, because Static Members can not be marked as a virtual, abstract or override.
VulpesPosted Feb 2, 2012, 11:03 AM