C++ constructors & destructors related inteview questions and answers

C++ Constructors and destructors.

Constructors is a special member function of a class that gets invoked when object of its class is created. It is used to initialize the object of its class. We can also pass initial values to Constructor function at the time of object declaration.

The name of the constructor is same as that of class.

Types of Constructors

Do nothing constructor: It doesn't contain any statement, has no argument and no return type.

Default constructor: It can have some initial statements but no parameters and arguments.

Parameterized constructor: It has parameters that can set initial values to an object at the time of declaration.

Copy constructor: It takes an object as an argument and is used to copy values of data members of one object into another object.

Destructors are used to destroy the objects that have been created by the constructor. Destructor names are same as the class, but they are preceded by a tilde (~).
C++ access privileges - Define access privileges in C++.
C++ access privileges - You have access privileges in C++ such as public, protected and private that helps in encapsulation of data..
C++ Structures and Classes - Explain the difference between structures and classes.
C++ Structures and Classes - Syntactically and functionally, both structures and classes are identical. By default, members of structures..
C++ Container class - Explain container class and its types in C++.
C++ Container class - A container stores many entities and provide sequential or direct access to them. List, vector and strings are such containers...
Post your comment
Discussion Board
c,c++,c#,ASP.NET MCQ question download
i want c,c++,c#,ASP.NET MCQ question and answer .how to download from this site please help me ..
megha 06-17-2015