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 do you use c# for?

967


How to get the sum of last 3 items in a list using lambda expressions?

974


Is arraylist type safe in c#?

1056


Is multilevel inheritance possible in c#?

970


Define assert() method? How does it work?

1208


What are access modifiers in c#?

1049


What are the 2 broad classifications of fields in c#?

974


Distinguish between continue and break statement?

1192


What is the use of partial methods?

1126


Why delegates are required?

1026


Is c# lazy thread safe?

953


What are the features of c#?

985


Which is faster hashtable or dictionary?

1067


How do I run managed code in a process?

1075


Define constructor in c#.

966