Can you override private virtual methods?
Answer Posted / vivek
virtual or abstract members cannot be private.
Ex: error occurs during the static compilation phase, which
means that no program that declares a private virtual method
will ever be executed in any way.
C#
class A
{
private virtual int Test()
{
return 1;
}
}
class Program
{
static void Main()
{
}
}
Compile-time error
Error 1
'A.Test()': virtual or abstract members cannot be private
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the correct way of declaring an xml namespace?
Why we use dll in c#?
What is a callback c#?
How can we make a thread sleep for infinite period ?
Why do we use interfaces in c#?
what is a enumeration in c#
Why is c# used?
What do you mean by directing?
1. Describe page life cycle?
Why do we need properties in c#?
What are collections in c#?
What is regex replace in c#?
What is difference between list and dictionary in c#?
Why do we use overloading in c#?
What is semaphore in c#?