Difference between overloading and Overriding. <Giving a
confusing example to test the concept.>
(also asked in PA Consultancy Group,iflex,Value
chain,IBM,CTS,Accenture, Tarang>

Answer Posted / priyanka patil

Function Overloading
class A
{
int show(int a,float b)
float show(int a,int b)//different prototype can valid but
as per parameters they called
}
Function overriding
class A
{
int show(int a)
};
class B : public A
{
int show(int a)//function prototype of base class fun n
derived class function must be same
}

Is This Answer Correct ?    26 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we have multiple classes in single file ?

609


What is stored procedure. How do you create stored procedure ?

1496


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

606


What do you mean by boolean?

580


How hashset works internally in java?

588






How to change value in arraylist java?

506


What is a line separator in java?

541


Explain the significance of listiterator.

590


What is the difference between a choice and a list?

608


How can we pass argument to a function by reference instead of pass by value?

588


What is pangram in java?

515


How many types of literals are there in JAVA?

596


What is the technique adopted to create an immutable class?

526


Can a class extend 2 classes in java?

559


How are the elements of a gridbaglayout organized in java programming?

520