Answer Posted / dharmendra nonia
No,We can't override the private virtual method because
it private access specifier does not allow to inherit the
private member of a class in a derived class.
Ex:--
-------
using System;
public class ABC
{
private virtual void mm()
{
}
}
public class abc:ABC
{
private override void mm()
{
Console.WriteLine("Hello");
}
}
class d:abc
{
public static void Main()
{
d D=new d();
D.mm();
}
}
Output:-
--------
ae.cs(4,23): error CS0621: 'ABC.mm()' : virtual or abstract
members cannot be
private
ae.cs(11,24): error CS0621: 'abc.mm()' : virtual or
abstract members cannot be
private
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Why is main static in c#?
What is a event in c#?
List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.
What is c# and why it is used for?
What is func c#?
What is meaning of type safety in c#?
What are verbatim strings in c#?
What namespace is list in c#?
how can one use hcl and c sharp together?
What are the steps for creating clr trigger
Describe two uses of the “using” statement during the operation of c#?
Why is c# good for games?
What is the CTS, and how does it relate to the CLS?
Explain manifest in c#.
Can you have more than one namespace in c#?