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 sort algorithm does c# use?
What are the types of comments in c#?
What is form feed and carriage return?
What is property in c#?
What is expression tree in c#?
Can we change static value in c#?
What are Types of assemblies that can be created in dotnet
What is hashtable c#?
How many types of constructors are there in c#?
What is the difference between dll and lib?
What is the use of base keyword? Tell me a practical example for base keyword’s usage?
What is a satellite assembly in c#?
What method is used to sort the elements of the array in descending order?
Can a private virtual method can be overridden?
Explain the various types of classes used in c#?