When will a constructor executed?
Answers were Sorted based on User's Feedback
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 |
Answer / rahul
When an object create means suddenly construtor get executed
Is This Answer Correct ? | 22 Yes | 3 No |
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 |
Answer / poorna chandar rao
when ever object is created automatically (conncurently
)construcor also executed
Is This Answer Correct ? | 6 Yes | 1 No |
why destructor is not over loaded?
#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
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?
What is a class?
32 Answers Infosys, TCS, Thylak,
What is the diamond problem in inheritance?
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
What is the default size allocated for array in the statement if size not specified " int a[] "
if u write a class do u write Assignment operator and copy constructor
When is a memory allocated to a class?
Program to open a file with First argument