10. Overloding and overriding.
Answers were Sorted based on User's Feedback
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 |
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 |
HttpHendler and HttpModules
Explain the number or character entered through keyboard gets converted to equivalent ascii code & it get stored on ram in the binary form. What is the exact procedure. : Dot net architecture
Do you know textbox and textview controls of .net mobile? : Microsoft dot net mobile
Explain about httpruntime.cach.get(); method?
What actually happes when you add a something to arraylistcollection ?
Explain different pipelining hazards and how are they eliminated? : Dot net architecture
Explain cache memory? : .NET Architecture
What is the mesi? : Dot net architecture
how windows applications different from the console applications?
What is the difference between an application and a program?
How can I write my own .NET host?
Explain the difference between l1 and l2 cache? : Dot net architecture