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?

Answers were Sorted based on User's Feedback



Can you override private virtual methods?..

Answer / tsahi

You cannot write virtual private methods, let alone override
them. as noted above, a private virtual method will not compile.

Is This Answer Correct ?    8 Yes 0 No

Can you override private virtual methods?..

Answer / 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

Can you override private virtual methods?..

Answer / swapna

No, we cannot access private methods in inherited classes.
They have to be protected in the base class to allow any
sort of access.

Is This Answer Correct ?    6 Yes 1 No

Can you override private virtual methods?..

Answer / sanjay

We cant override private virtual methods...

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More C Sharp Interview Questions

Are c# objects passed by reference?

0 Answers  


Define parsing? Explain how to parse a datetime string?

0 Answers  


i have a question which is quite simple but yet complicated for me my question is why do we use void, if it does not return anything to the compiler? if it is used for normal display it can also be done by what is called Console.Write() or Consol.WriteLine() and if i do not use void with my method then my compiler throws me an error. if i return a value say integer then i write public int fun() display of the result can also be done here then why is it so necessary to use void with a function and why so compiler throw us an error if v don't use void return type?

2 Answers  


What is thread in c#?

0 Answers  


What is a hash table c#?

0 Answers  


Explain About Postback

0 Answers   BirlaSoft,


How to reverse each word in a string using c#?

0 Answers   Infosys,


What are desktop applications examples?

0 Answers  


Can you prevent your class from being inherited and becoming a base class for some other classes?

2 Answers   Mind Tree,


4. Describe the process when we send a request URL? And who is responsible for that?

0 Answers   Mphasis,


What is scaffolding in c#?

0 Answers  


difference between keyword internal and protected?

5 Answers   HCL,


Categories