Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions
Technical Discussion :: C++

94 / 184

What are characteristics of the constructor function?

Answer:

The constructor functions have some characteristics:

• They should be declared in the public section.
• They got invoked automatically when the objects are created.
• They do not have return types, not even void and therefore, they cannot return values.
• They cannot be inherited, through a derived class can call the base class constructor.
• Like other c++ functions, they can have default arguments.
• Constructors cannot be virtual.
• We cannot refer to their addresses.
• An object with a constructor cannot be used as a member of a union.
• They make implicit calls to the operators new and delete when memory allocation is required.

When a constructor is declared for a class, initialization of the class objects becomes mandatory.

Asked In ::

Post Your Answer Here:


Rate This: +0 -0     
Report    

Post Your Reply Here:

Alert me
q4i-reply-your-answer

Report Error

Please Login First Click Here

Most Popular Qs.