ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C++ >> C++ General
 
 


 

 
 STL interview questions  STL Interview Questions (93)
 OOPS interview questions  OOPS Interview Questions (562)
 C++ General interview questions  C++ General Interview Questions (459)
Question
Difference between Overloading and Overriding?
 Question Submitted By :: C++-General
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
Overloading - Two functions having same name and return
type, but with different type and/or number of arguments.
Overriding - When a function of base class is re-defined in
the derived class.
 
Is This Answer Correct ?    769 Yes 98 No
Swetcha
 
Answer
# 2
1. In overloading,there is a relation ship between methods
available in the same class where as in overridding,there
is relationship between a super class method and subclass
method.
2. overloading doesn't block inheritence from the
superclass where as overridding blocks inheritence.

3. in overloading,seperate methods share the same name
where as in overridding,subclass methods replaces the
superclass.

4.overloading must have different method signatures where
as overriding must have same signature.
 
Is This Answer Correct ?    447 Yes 73 No
Janet
 
 
 
Answer
# 3
The main difference between overloading and overriding is
that in overloading we can use same function name with
different parameters for multiple times for different tasks
with on a class.
and overriding means we can use same name fiunction name
with same parameters of the base class in the derived class.
this is also called as reusability of code in the programme.
 
Is This Answer Correct ?    280 Yes 61 No
Shivanand
 
Answer
# 4
Overloading is compile time binding, where as overriding is
dynamic binding.
 
Is This Answer Correct ?    120 Yes 37 No
Natarajan
 
Answer
# 5
Overloading is compile time binding, where as overriding is
dynamic binding.....
 
Is This Answer Correct ?    92 Yes 22 No
Ramesh Pedhamalla
 
Answer
# 6
* in overloading function name are same but signatures
(argument) are different .
while in overriding function name are as well as argument
are same in drive class as in super class.
* for overloading can be done in one class but
for overriding there is necessary that at least two class
should be present.
 
Is This Answer Correct ?    87 Yes 23 No
Gaurav Rawat
 
Answer
# 7
overloading: same name but different signatures in same class
overriding: same name and same signature defined in
different class.
 
Is This Answer Correct ?    93 Yes 32 No
Meenu Kathuria
 
Answer
# 8
overriding is done in the base class where the parent class
method is overridden by a method of the same signature.

Overloading is done in the same class on functions with
input parameters differing in number or type.
 
Is This Answer Correct ?    94 Yes 34 No
Adeel Shahid
 
Answer
# 9
It does not block superclass method it will override the
super class method
 
Is This Answer Correct ?    85 Yes 61 No
N.balasutha
 
Answer
# 10
Overloading is evaluaated at compile time whereas
Overriding is evaluated at Run Time.

Overloading method has different Parameters but same name
whereas Overriding is just the implementation of method
define din Base Class.

Overloading does not interfere Base Class whereas
Overriding method must require the method which is declared
in Base Class.

Overloading can be defined in one class,in short term it
does not require separate Base Class to implement the
method,whereas for implementing method overriding the Base
class is necessary..
 
Is This Answer Correct ?    12 Yes 4 No
Mansi Shah
 

 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
What is the difference between = and == in C? Intel 13
What is the Difference between "printf" and "sprintf"? iSoft 7
How to write Multithreaded applications using C++? Honeywell 2
what is data Abstraction? and give example TCS 142
class Foo { int x; public: Foo(int I); }; If a class does not have a copy constructor explicitly defined one will be implicitly defined for it. Referring to the sample code above, which one of the following declarations is the implicitly created copy constructor? a) Foo(Foo *f); b) Foo(Foo &f); c) Foo(const Foo *f); d) Foo(const Foo &f); e) Foo(int); Quark 3
How many types of casting are there in C++? When is a dynamic cast,static_cast,reinterpret cast used? CTS 2
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].   1
class basex { int x; public: void setx(int y) {x=y;} }; class derived : basex {}; What is the access level for the member function "setx" in the class "derived" above? a) private b) local c) global d) public e) protected Quark 3
what is the size of this class class size { public: char data1; double d; int data2; char data3; double data4; short data5; }; please explain the padding for these double variables.   9
why can't we declare data member of class auto register or extern   1
How const functions will be treated by compiler? Symphony 3
You have to take 2 arrays of length 10. Input the values of array 1 from the user. Then copy the values of array 1 to array 2 in ascending order For example if user enters 9, 5, 6, 8, 1, 0, 2, 7, 4, 3 then copy the smallest element i.e. 0 first followed by 1, 2 and so   1
 
For more C++ General Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com