Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is virtual constructors/destructors?

Answers were Sorted based on User's Feedback



What is virtual constructors/destructors?..

Answer / nk

There is nothing like virtual constructors but we can have
virtual destructors so that the destructor of the correct
object is called.
Ex.

Base *bptr = new derived()

delete bptr; then the destructor of the derived objetc is
called when the base destructor is marked as virtual.

else destructore of base class is called and may lead to
memory leak if we have allocated any new memory.

Is This Answer Correct ?    18 Yes 1 No

What is virtual constructors/destructors?..

Answer / debasish

there is no virtual constructor..coz..virtual thing is in
run time n constructor ic compile time thing.

Is This Answer Correct ?    15 Yes 3 No

What is virtual constructors/destructors?..

Answer / syed abdul gaffur.

CONSTRUCTOR:

Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error.

DISTRUCTOR :

If an object (with a non-virtual destructor) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching the pointer type) is called on the object

Is This Answer Correct ?    7 Yes 0 No

What is virtual constructors/destructors?..

Answer / khadeer.k

virtual constructors are used when we need to avoid the
copy same. desructor frees the memory with a ~(tilde) symbol

Is This Answer Correct ?    8 Yes 9 No

Post New Answer

More OOPS Interview Questions

Will I be able to get a picture in D drive to the c++ program? If so, help me out?

0 Answers  


Whats is abstraction in oops?

0 Answers  


What is purpose of inheritance?

0 Answers  


What is abstract class in oop?

0 Answers  


What are callback functions in c++

1 Answers   SoftTech,


Petrol pump mgt. system: To design a program that display an interface for the sale of the Petrol and then make the entries at the backend in the database.

1 Answers   Wipro,


explain the concepts of oops?

1 Answers  


Why is oop useful?

0 Answers  


How is exception handling carried out in c++?

3 Answers  


How do you define social class?

0 Answers  


namespace is working on which compiler?

3 Answers  


what is code for call by value and call by reference?

1 Answers  


Categories