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?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe these concepts: Polymorphism, Inheritance and Abstraction.

1156


#include #include #include #include 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

2579


Can destructor be overloaded?

989


What is destructor oops?

1043


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6639


What is byval and byref? What are differences between them?

2162


What is the difference between encapsulation and polymorphism?

1060


Why multiple inheritance is not possible?

1030


Why oops is important?

1050


Explain virtual inheritance?

1143


What is the difference between abstraction and polymorphism?

1066


Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

4099


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

2112


What are properties in oop?

1034


What is encapsulation in oops?

972