C++ Programming
Interview Questions And Answers
Q: - When does a name clash occur in C++?
A name clash occurs when a name is defined in more than one place. For example., two different class libraries could give two different classes the same name. If you try to use many class libraries at the same time, there is a fair chance that you will be unable to compile
or link the program because of name clashes.
Submitted By:-David Email-ID: - David_Willa121@yahoo.com
Q: - What is virtual constructors/destructors?
virtual constructors/destructors : Virtual destructors It is a Bassically same as vertual fuction, Its commonly used with inheritance. Since an abstract class must contain a pure virtual method that has to be overridden, a lot of developers commonly declare their destructors pure virtual, since a destructor is sure to be implemented in every subclass.Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. There is no virtual constructor coz virtual thing is in run time n constructor is compile time thing.
Submitted By:-David Email-ID: - David_Willa121@yahoo.com
Q: - What is the difference between "overloading" and "overriding"?
Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.overridding is runtime polymorphism while overloading is compile time polymorphism.
Submitted By:- David Email-ID: - David_Willa121@yahoo.com
![]() |


