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

declare method1 as virtual in classA and then create classB
as derived class of ClassA and override method1 in classB.

class ClassA{
public virtual add();

}

class ClassB:ClassA{
public overrride add(){

console.WriteLine("Im in derived");

}

}

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is php easier than c#?

851


How long has c# been around?

922


What is the difference between protected and internal in c#?

942


Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?

1005


How we can create an array with non-default values?

906


Is it possible to inline assembly or il in c# code?

966


Explain deadlock?

913


What does console mean c#?

872


Is c sharp free?

874


without modifying source code if we compile again, will it be generated MSIL again?

859


How do I declare inout arguments in c#?

889


What is option parameter in C#?

925


What is the use of 'as' Keyword in C# ?

965


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

952


What is a console device?

840