.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

what is overriding?

Posted By: PankajGupta     Posted Date: August 05, 2009    Points:2   Category :C#
what is overriding in C#?

Responses
Author: Venkat             
Posted Date: August 05, 2009     Points: 5   

The override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.

In below Example the class Square must provide an overridden implementation of Area because Area is inherited from the abstract ShapesClass:


Copy Code abstract class ShapesClass
{
abstract public int Area();
}

class Square : ShapesClass
{
int x, y;
// Because ShapesClass.Area is abstract, failing to override
// the Area method would result in a compilation error.
public override int Area()
{
return x * y;
}
}

http://msdn.microsoft.com/en-us/library/ebca9ah3(VS.80).aspx

Mark As Answer if this solve your problem
Warm Regards,
Venkat


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend