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

virtual or abstract members cannot be private.

Ex: error occurs during the static compilation phase, which
means that no program that declares a private virtual method
will ever be executed in any way.
C#
class A
{
private virtual int Test()
{
return 1;
}
}

class Program
{
static void Main()
{
}
}

Compile-time error

Error 1
'A.Test()': virtual or abstract members cannot be private

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between directcast and ctype.

974


Why is it important to override gethashcode when equals method is overridden?

986


What is data types in c#?

913


How is a strongly-named assembly different from one that isn’t strongly-named?

1013


What is getenumerator?

813


What is inline function in c#?

933


What is the c# equivalent of c++ catch (...), Which was a catch-all statement for any possible exception?

962


What happens if a static constructor throws an exception?

909


Why do we use classes?

842


Why constructor is used in c#?

868


What is console readkey in vb net?

1042


What are the different types of literals in c#?

1003


What is native image generator (ngen.exe)?

1191


What is difference between event and delegate in c#?

888


What is encapsulation in csharp?

945