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

What is bitwise operator in c#?

860


Will the following code compile?

906


What is class method?

879


Which is faster abstract class or interface in c#?

923


Can you put two constructor with the same structure in a class?

860


What is dictionary class in c#?

879


How to find Percentage, name ,College from a resume or document ? How to export these values to other page in C#?

872


Why main is static in c#?

977


What is the difference between func and action delegate?

888


What is generic delegates in c#?

914


What is unrecognized escape sequence in c#?

875


What is thread.sleep()?

852


in the nunit test framework, which attribute must adorn a test class in order for it to be picked up by the nunit gui?

1100


List the difference between interface and abstract class?

812


What is winforms c#?

904