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
Is for loop faster than foreach?
What is an indexer in c#?
What is c# used for in the industry?
What type of data type conversion happens when the compiler encounters the following code?
Can you describe iuknown interface in short?
What are the different types of classes in c#?
What are handlers in c#?
What is c# most used for?
What is decimal in c#?
Is it possible to force garbage collector to run?
Is c# used for any core features of windows vista?
Is c# static or dynamic?
How does array sort work?
Define method overloading in c#?
what are nullable types in c#