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

If I want to override a method 1 of class A and in class b
then how do you declare ?

Answer Posted / ch.venu

Ans:
we can override the parent class method under its child
class only when the parent class declared the method as
virtual

ex:
class Parent
{
public virtual void Test()
}
now thar virtual method of the parent class can be override
the child class using override modifier

ex:

class child:Parent
{
public override void Test()
{
Console.WriteLine("hi this is derived class") ;
}
}

but it is only optional for the child classs to override the
virtual method of its parent class

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between throw and throw ex?

892


HOW to Develope the CRUD(create,read,update,delete) FORM IN WINDOWS form by using c# only

961


How are delegates chosen?

901


What is the difference between a variable and a literal?

1069


Are c# destructors the same as c++ destructors?

1148


What are different types of classes in c#?

913


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

1010


What are data types in C#?

998


Why static variables are used?

1039


What is the difference between out and ref in c#?

1050


What is ildasm.exe used for?

1025


What is the process of Serialization?

1007


Differentiate between copy and default constructor.

1037


What is difference between events and delegates?

950


what is the scope of anonymous type ?

1050