In c++ there is only virtual destructors, no constructors. Why?
Answer Posted / uma sankar pradhan
constructors are invoked at the time of object creation.
The v-table for virtual function mechanism is not
intialised properly during the constructor invocation.
So constructors cannot be virtual
But,destructors can be virtual.Because the V-table is
properly initialised at the time of object creation.
So the v-table is available for the destructors.
Destructors can be made pure virtual also.But unlike other
member functions,it must be redfined outside the class.
Is This Answer Correct ? | 57 Yes | 22 No |
Post New Answer View All Answers
write a programe to calculate the simple intrest and compund intrest using by function overlading
What is methods in oop?
What are classes oop?
Can we define a class within the interface?
what's the basic's in dot net
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.
What is balance factor?
program for insertion ,deletion,sorting in double link list
Are polymorphisms mutations?
What is overriding in oop?
What is polymorphism in oop example?
Write a c++ program to display pass and fail for three student using static member function
What is class and object in oops?
Why polymorphism is used in oops?
What is the benefit of oop?