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 gives the current position of the put pointer?

1001


In a function declaration, what does extern mean?

1064


How would you differentiate between a pre and post increment operators while overloading?

1149


Explain how functions are classified in C++ ?

1234


Write my own zero-argument manipulator that should work same as hex?

1053


Explain about vectors in c ++?

1032


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

1034


How does com provide language transparency?

1010


What is c++ coding?

1206


What do you mean by vtable and vptr in c++?

1043


Explain data encapsulation?

1129


How can you quickly find the number of elements stored in a dynamic array?

1054


I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

2797


What is vector pair in c++?

1229


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

1056