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

What is scaffolding in c#?

0 Answers  


How do you create user defined data types in c#?

0 Answers  


About a class access specifiers and method access specifiers ?

3 Answers   MMTS,


What is datagrid c#?

0 Answers  


What is the difference between returning iqueryable vs ienumerable?

0 Answers  


Is there any way to access private memebers of an object from another object?

4 Answers   TCS,


ctype(123.34,integer) - should it throw an error? Why or why not?

2 Answers   Wipro,


What are the Different kinds of methods?

4 Answers   Wipro,


Can you describe iuknown interface in short?

0 Answers  


Write the syntax for catching an exception in c#?

0 Answers  


What can you do as a .net developer?

0 Answers  


Does hashset allow duplicates c#?

0 Answers  


Categories