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

Explain the difference between the public, private, final, protected, and default modifiers?

549


Why do we need data structure in java?

572


What is array sorting in java?

551


What does jenkins do?

484


What is null object in java?

570






Can the garbage collection be forced by any means?

528


What is the purpose of skeleton and stub?

585


How to Sort Strings which are given in List and display in ascending order without using java api.

3761


Why java applets are more useful for intranets as compared to internet?

577


What is the full name of java?

563


Can inner class have constructor?

545


What causes memory leak in java?

475


What technique is carried out to find out if a particular string is empty?

567


What is object cloning in Java?

629


What happens if I remove static from main method?

519