OVERLOADING AND OVERRIDING

Ads
 

OVERLOADING AND OVERRIDING

View Answers

August 26, 2011 at 6:20 PM

Overloading and Overiding are pratical implementation of OOPs Concept.

Overloading:

In Simple words, Same function name but different signature(Parameters)

For Example:

To Add 2 integers Add(int i, int j)

To add two string Add(string i, string j)

Depending on the signature(parameters) of the calling function, respective function would be called. if you pass 2 string parameter second function would be called and if you pass two integer parameter first function would be called.

Overriding(Polyphormism):

Same Function Name, same signature, different functionality.

Example for overriding

Class Shapes { Virtual void Paint() }

Class Circle:Shapes { Override void Paint() }

Class Square:Shapes { Override void Paint() }

Here in the above code we can see that the shapes is class which has a method Paint, which would paint according to the shape of the object each object would implement the paint method differently based on its dimensions.

Ads









Related Tutorials/Questions & Answers:
examples for overloading and overriding
examples for overloading and overriding  examples for overloading and overriding
overloading and overriding in c
overloading and overriding in c  can anyone explain the concept of overloading and overriding in reference to c programming...through an example if possible
Advertisements
What is use of method overloading and overriding?
What is use of method overloading and overriding?  Method overriding... in advance   Overriding is useful when you want to change the functionality of some method based on a class. For example, by overriding the toString
Tell me where we are using overloading and overriding in realtime project?
Tell me where we are using overloading and overriding in realtime project?  Hi,Tell me where we are using overloading and overriding in realtime project? please give me answer
difference
difference  difference between Method Overloading and method Overriding   Difference between Method Overloading and Method Overriding... the following links: Java Method Overloading Java Method Overriding
java
java   i want the codings of transport services using the concept of abstract classes and methods,static members,inheritance,overriding concepts,constructor overloading   Hi Friend, Please specify some more details
java
java  01)state 3 restrctions in overriding a method. 02)can you..., argument list, and return type. The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions
what are the techniqes in polymorphisum in java?what are their applications?
ways: Method Overloading Method Overriding For more information, visit
Method
and the other one is the class method.     Method Overloading... is known as method overloading. With the help of this feature we can define two methods...; Method Overriding   Overriding is another useful feature of object
What is Polymorphism in Java?
can be seen through Inheritance, method overloading and method overriding... writing code. Single polymorphism is achieved by method overriding while multiple
Core Java Interview Question, Interview Question
is the difference between Overloading and Overriding Answer:  Overloading : Reusing... is called as overloading Overriding : Using the same method name with identical arguments and return type is know as overriding Question: What do you
Java Constructor Overloading Example
Java Constructor Overloading Example In this section we will read about the constructor overloading in Java. We will see how the constructor overloading... programming is called constructor overloading. Constructors with different
Java7 : OOPs Concepts
the method overloading and method overriding techniques
Introduction
time polymorphism is supported through the method overloading concept in java.  Method overloading means having multiple methods with same name... time. The example of run time polymorphism is method overriding. When
JavaScript Array
;  Java method Overriding Below example illustrates method Overriding in java. Method overriding in java means a subclass method overriding a super class method. Superclass method should be non-static
Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
; Q 2 : Is println overloading or overriding ?  Ans : The println() method is the method of the PrintWriter  class which is an example of overloading...;    Q 1 : How should I create an immutable class ? Ans

Ads