Your Ad Here

Sunday, December 28, 2008

C++ Interview Questions & Answers

Q : How do youn delete an element in array of string?

A : Reduce the array size.

if(stringarryname)

{

delete[] stringarryname;

delete stringarryname;

stringarryname = NULL;

}


Q : What is the difference between an overload assignment operator and an a copy constructor?

A :. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class. A copy constructor constructs a new object by using the content of the argument object


Q :What is the virtual destructor?

A : The virtual destructor is one that is declared with the virtual attribute.

The behavior of a virtual destructor is what is important. If you destroy an object through a baler or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be compile.

Q: What is the Difference between C and C ++?

A : C is a structured programming language. The C++ is an object oriented language. C++ is also called as C with Classes.

both C and C++ are programming languages. C++ is termed as superset of C.
C is a powerful and elegent language.almost all c PROGRAMS ARE ALSO c++ PROGRAMS. C, it facilitates--" topdown structured design" as against C++ provides bottom-up object-oriented design. C language is built from functions (like printf)that execute different tasks.

Q : Difference between a template class and class template in C++?

A : Template class: A generic definition or a parametrized class not instantiated until the client provides the needed information. It is the jargon for plain templates.
Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It is jargon for plain classes.

Q : What is the polymorphism in C++?

A : Polymorphism in the C++ is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and base class array can store different child class objects.

0 comments:

Your Ad Here