When will a constructor executed?

Answers were Sorted based on User's Feedback



When will a constructor executed?..

Answer / ssss

When ever object is created.

Is This Answer Correct ?    27 Yes 2 No

When will a constructor executed?..

Answer / preeti

Constructor execution is depend on its type like,

1) inbuilt or default construtor, no parameter constructor
are executes whenever object creates.

2) parameterized constructor execute whenever it calls.

3) base class constructor execute before than child class
constructor(child class is derived from base class
constructor).

Is This Answer Correct ?    21 Yes 1 No

When will a constructor executed?..

Answer / rahul

When an object create means suddenly construtor get executed

Is This Answer Correct ?    22 Yes 3 No

When will a constructor executed?..

Answer / priya

Constructor gets called when we create an object,or when we
allocated memory using new operator:

void main()
{
test *t = new test;
delete t;
}

Is This Answer Correct ?    13 Yes 0 No

When will a constructor executed?..

Answer / poorna chandar rao

when ever object is created automatically (conncurently
)construcor also executed

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More OOPS Interview Questions

why destructor is not over loaded?

5 Answers  


#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

0 Answers  


what is the main difference between c and c++?

386 Answers   AZTEC, B.Tech, CMC, College School Exams Tests, HCL, IBM, ITM, Khalsa Institute, Microsoft, Oracle, Sanjeevni Institute, TCS, Tech Mahindra, Wipro, ZeOmega,


Why oops is important?

0 Answers  


What is a class?

32 Answers   Infosys, TCS, Thylak,






What is the diamond problem in inheritance?

0 Answers  


What is OOPS and How it is different from Procedural Programming ?

23 Answers   HP, Infosys, Thyrocare,


write string class as your own class in java without using any built-in function

0 Answers  


What is the default size allocated for array in the statement if size not specified " int a[] "

4 Answers   CTS,


if u write a class do u write Assignment operator and copy constructor

1 Answers   Siemens,


When is a memory allocated to a class?

11 Answers  


Program to open a file with First argument

1 Answers   TCS,


Categories