.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 >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

What is Method Overriding? How to override a function in C#?

Posted By :Amit Mehra     Posted Date :September 07, 2008    Points :10   Category :.NET Framework 
Use the override modifier to modify a method, a property, an indexer, or an event. An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override.

You can also find related Interview Question to What is Method Overriding? How to override a function in C#?  below: 

Can you declare an override method to be static if the original method is not static?

  
No. The signature of the virtual method must remain the same.
(Note: Only the keyword virtual is changed to keyword override). (More...)

How's method overriding different from overloading?

  
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class. (More...)

Main Difference between Method and function?

  
Method which tied to a class where as function need not to be. In OOPS we can say there is no functions concept because all the method is tied to a class.

Function is available in procedural language, Scripting language that why we say JavaScript function etc. (More...)

How the concept of method overriding different from method overloading?

  
When overriding occurs on a method, you can change the behavior of the method for the class you have derived. Overloading a method involves in having another method with the same name within the class. (More...)

Can you declare the override method static while the original method is non-static?

  
No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override. (More...)

How is method overriding different from method overloading

  
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves
having another method with the same name within the class.
(More...)

What is the method for returning more than one values from a function in VB?

  
Use ByRef for the variables or return an array of values (More...)

What is Method overloading?

  
Method overloading occurs when a class contains two methods with the same name, but different signatures. (More...)

Can we call a base class method without creating instance?

  
Its possible If its a static method.

Its possible by inheriting from that class also.

Its possible from derived classes using base keyword. (More...)

What is Method used to bind the data into gridview ?

  
DataBind() Method used to bind the data into gridview (More...)

What method is used to place a value onto the top of a stack?

  
push() method, Push is the direction that data is being added to the stack. push() member method places a value onto the top of a stack. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


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