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...

About Virtual functions and their use ?

Answer Posted / deepak jindal

If a base class method is to be overriden, It is defined
using virtual keyword. You need to use the override keyword
in order to re-implement the virtual method. Exp:

public class Employee
{
public virtual void SetBasic(float money) //This method may
be overriden
{ Basic += money; }
}


public class Manager : Employee
{
public override void SetBasic(float money) //This method is
being overriden
{
float managerIncentive = 10000;
base.SetSalary(money + managerIncentive); //Calling base
class method
}
}

Is This Answer Correct ?    14 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is returned if you pass the value 12.34 to the parsefloat () function?

1010


What is the difference between proc. Sent by val and by sub?

1042


How to sort an int array in c#?

1008


What are the benefits of using generics?

1063


Distinguish between a class and struct?

979


Which class does the remote object has to inherit?

1102


Explain hash table in c# ?

1117


What does type safe mean in c#?

1046


What is the interface in c#?

995


Why do we need abstract class?

956


What operator means?

931


What is dictionary and hashtable in c#?

1024


Why generics are used in c#?

1001


Explain how obfuscator works in .net

1070


List down the reason behind the usage of c# language.

1378