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 instantiating a class?
Is c sharp open source?
What’s thread.sleep() in threading ?
What are floating point numbers?
Why do we use reflection in c#?
In a site to turn off cookies for one page which method is followed?
What is field in c#?
What are classes in c#?
What is the difference between a variable and a literal?
Why do we need dependency injection in c#?
What Happens In Memory When You Box And Unbox A Value-type?
Why do we use Design Pattern in C#?
What is a framework in c#?
What is a hashset c#?
How long does a loop recorder procedure take?