10. Overloding and overriding.

Answer Posted / preetham

Overloading :

If you want to use same method in a different ways by using different method signatures.It should be in the same class.
In the below example there is no parameter passed in first time calling but same method we used with passing multiple parameters. This is what overloading means.
Ex: public void FirstMethod(){}
public void FirstMethod(int i, string s){}

Overriding :

It deals with two methods one in a parent class and one in a child class that have the same signature.
The method in parent class should be declared as virtual and the method in the derived class should be declared as override in their method signature. Every virtual method in the parent class should be override in the derived class.
Ex : public virtual void FirstMethod(){}
public override void FirstMethod(){}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's new in the .net 2.0 class library?

543


Explain Intermediate Language?

609


What is the difference between l1 and l2 cache? : Dot net architecture

525


How do I stop a thread?

543


hi, kindly send WWF(.net 3.5) pdf notes to my id. thanx in advance, chays

1888






Explain the race around condition? : .NET Architecture How can it be overcome? : .NET Architecture

502


How can we perform data binding in atlas?

524


Explain how does .net mobile work? : Microsoft dot net mobile

501


4. Wcf- what Asych and Sych call and how that works

1447


What is Object Caching in Visual Studio 2010?

602


Whate are resource files? How are they used in .net?

499


What is code access security (cas)?

573


What is the mesi? : Dot net architecture

548


What does the term "green architecture" mean? : .NET Architecture

555


How do I prevent concurrent access to my data?

555