10. Overloding and overriding.

Answers were Sorted based on User's Feedback



10. Overloding and overriding...

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

10. Overloding and overriding...

Answer / pinki

Overloading methods
1.They appear in the same class or a subclass
2.They have the same name but, have different parameter
lists, and can have different return types.
An example of an overloaded method is print() in the
java.io.PrintStream class

Overriding methods
It allows a subclass to re-define a method it inherits from
it's superclass
overriding methods:
1. It appears in subclasses
2. They have the same name as a superclass method
3. They have the same parameter list as a superclass method
4. They have the same return type as as a superclass method
5. They have the access modifier for the overriding method
may not be more restrictive than the access modifier of the
superclass method

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net AllOther Interview Questions

Does application frame need host?

0 Answers  


9. Oop-Class A has m1 metthode Class B has m1 metthode and C is the calss that inharits A class, A class inharits B class. If Object dim c as new A() c.m1(), Tell me which mettode of class will call

2 Answers   PCS,


What is cookie less session?

0 Answers  


In LINQ TO SQL if it is possible to select the top 5 records from the particular table using select top 5.

1 Answers   Agiline,


i wish to write mcts(microsoft certified technology specialist) exam. can anyone give the model question or format and preparation method?

0 Answers  






What is VSS? Use of VSS? How can we use VSS in our Application?

4 Answers  


I can't be bothered with cas. Can I turn it off?

0 Answers  


Explain the difference between primary & secondary storage device? : .NET Architecture

0 Answers  


What is the .net class that allows the retrieval of a data element using a unique key?

0 Answers  


What is new in the .net 2.0 class library?

0 Answers  


Define the mesi? : Dot net architecture

0 Answers  


3. Should validation (did the user enter a real date) occur server-side or client-side? Why?

4 Answers  


Categories