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
Can we have multiple classes in single file ?
What is stored procedure. How do you create stored procedure ?
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?
What do you mean by boolean?
How hashset works internally in java?
How to change value in arraylist java?
What is a line separator in java?
Explain the significance of listiterator.
What is the difference between a choice and a list?
How can we pass argument to a function by reference instead of pass by value?
What is pangram in java?
How many types of literals are there in JAVA?
What is the technique adopted to create an immutable class?
Can a class extend 2 classes in java?
How are the elements of a gridbaglayout organized in java programming?