When will a constructor executed?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What polymorphism means?

624


can we make game by using c

3429


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

699


What is polymorphism in oop example?

515


What is polymorphism and example?

592






Can you name some types of inheritance?

641


What does no cap mean?

592


Can you inherit a private class?

633


Can we override main method?

607


What is the difference between a mixin and inheritance?

522


What are the 3 principles of oop?

619


What is cohesion in oop?

624


Prepare me a program for the animation of train

2000


Why do while loop is used?

577


What is encapsulation and abstraction? How are they implemented in C++?

637