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


Please Help Members By Posting Answers For Below Questions

write a programe to calculate the simple intrest and compund intrest using by function overlading

1658


What is methods in oop?

535


What are classes oop?

591


Can we define a class within the interface?

547


what's the basic's in dot net

1732






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.

687


What is balance factor?

575


program for insertion ,deletion,sorting in double link list

2274


Are polymorphisms mutations?

691


What is overriding in oop?

541


What is polymorphism in oop example?

507


Write a c++ program to display pass and fail for three student using static member function

2800


What is class and object in oops?

605


Why polymorphism is used in oops?

575


What is the benefit of oop?

564