:: 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                      
Categories >> Software >> Programming Languages >> C++ >> C++ General


 STL interview questions  STL Interview Questions (93)
 OOPS interview questions  OOPS Interview Questions (563)
 C++ General interview questions  C++ General Interview Questions (461)
What is the difference between "overloading" and "overridding"?
 Question Submitted By :: C++-General
I also faced this Question!!     Answer Posted By  
# 1
overloading means that we can use same method with same
name many times for multiple purpose in a class with
difference parameters.

overriding means we can refer a method of a base class with
same name in a derived class with same paameters.
Is This Answer Correct ?    8 Yes 0 No
# 2
Overloading: When more then 1 methods in a class having same
name but they are different in their number of parameters,
different in their parameters types and their order.

Overriding: When a parent class is derived by a child class
and some method which has present in parent class which is
declared as "virtual" in parent class , same method with
same name and parameters and sam type is also declared in
child class without "virtual" keyword, bcz it is by default
Is This Answer Correct ?    4 Yes 0 No
Shakti Singh Khinchi
# 3
Overloading uses same funtion with different parameters

Overriding Uses same exactly similar funtion prototypes
this used in runtime polimorphism ie Virtual Funtions
Is This Answer Correct ?    2 Yes 0 No

Other C++ General Interview Questions
  Question Asked @ Answers
What are the different operators in C++? HP 3
string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring Quark 1
what is data Abstraction? and give example TCS 143
class X { private: int a; protected: X(){cout<<"X constructor was called"<<endl;} ~X(){cout<<"X destructor was called"<<endl} }; Referring to the code above, which one of the following statements regarding "X" is TRUE? a) X is an abstract class. b) Only subclasses of X may create X objects. c) Instances of X cannot be created. d) X objects can only be created using the default copy constructor. e) Only friends can create instances of X objects. Quark 2
How to detect memory leaks in c++ Mphasis 1
What are the advantages and disadvantages of using inline and const? TCS 1
Difference between Top down and bottom up approaches for a given project ? HP 13
how to swap two numbers with out using temp variable TCS 12
How to avoid a class from instantiation? Symphony 8
class Alpha { public: char data[10000]; Alpha(); ~Alpha(); }; class Beta { public: Beta() { n = 0; } void FillData(Alpha a); private: int n; }; How do you make the above sample code more efficient? a) If possible, make the constructor for Beta private to reduce the overhead of public constructors. b) Change the return type in FillData to int to negate the implicit return conversion from "int" to "void". c) Make the destructor for Alpha virtual. d) Make the constructor for Alpha virtual. e) Pass a const reference to Alpha in FillData Quark 2
let a,b,c be three integer numbers.write a c++ program with a function void rotate 1()such that a->b->c and c->a.   1
For more C++ General Interview Questions Click Here 

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