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

tel me oops defination in single line

2 Answers  


What is virtual function?where and when is it used?

2 Answers   Sitel,


Given two strings like x=?hello? and y=?open?, remove any character from string x which is also used in string y, thus making the result x=?hll?.

13 Answers   IBM,


Write a program to demonstrate the use of 'Composition' in C++

2 Answers  


#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; a.x = 22; int c = a.x; int *b = new int; cout << c; return 0; } option: No output 0 22 -(11) Will not compile

1 Answers   CTS, Wipro,






What is the point of polymorphism?

0 Answers  


what do you mean by static member variable?

2 Answers  


Can bst contain duplicates?

0 Answers  


what is static?

4 Answers  


What does sksksk mean in text slang?

0 Answers  


What do we mean by a hidden argument in C++?

1 Answers  


How to call a non virtual function in the derived class by using base class pointer

3 Answers   HCL,


Categories