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

Why do we override in c#?

873


In a single .NET DLL how many classes it contains?

931


What is the difference between writeline and write in c#?

853


Is c# code is managed or unmanaged code?

1033


how to insert the data from the grid view to database table though button click.pls send the answer to mail id suri1319@gmail.com

1909


What is JIT (just in time)? how it works?

1003


What is a c# delegate?

1065


what is difference between destruct or and garbage collection ?

944


What is polymorphism and its types in c#?

896


Does the system.exception class have any cool features?

1027


how to sort an array in c#

995


What is the use of protected in c#?

944


What is routing in c#?

906


Why linq is having select clause at the end?

914


What is an escape sequence in c#?

978