Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can you override private virtual methods?

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


Please Help Members By Posting Answers For Below Questions

Why is main static in c#?

944


What is a event in c#?

870


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.

884


What is c# and why it is used for?

936


What is func c#?

981


What is meaning of type safety in c#?

844


What are verbatim strings in c#?

893


What namespace is list in c#?

905


how can one use hcl and c sharp together?

2072


What are the steps for creating clr trigger

1021


Describe two uses of the “using” statement during the operation of c#?

939


Why is c# good for games?

935


What is the CTS, and how does it relate to the CLS?

983


Explain manifest in c#.

937


Can you have more than one namespace in c#?

914