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...

Can we have "Virtual Constructors"?

Answer Posted / meet

Constructor cannot be virtual. Because C++ is statically typed language. It is meaningless to the C++ compiler to create the object polymorphically. But it is possible to achieve behaviour like virtual constructor. This can be done by using factory design pattern.
Visit this link to know more about virtual constructor:
http://www.geeksforgeeks.org/advanced-c-virtual-constructor/

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are friend functions in C++?

1115


If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?

1147


Explain the differences between private, public and protected and give examples.

1067


What are the implicit member functions of class?

1130


Is c++ a high level language?

1049


What is a breakpoint?

1073


Which c++ compiler is best?

1202


What are member functions used in c++?

1208


What jobs can you get with a c++ certification?

1105


Differentiate between realloc() and free().

1101


Explain Memory Allocation in C/C++ ?

1115


Why is main function important?

1173


What are the advantages of c++ over c?

1134


How many types of scopes are there in c++?

1167


What are the extraction and insertion operators in c++?

1054