Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on c++ within the C and C++ forums, part of the Software Development category; can a constructor be virtual...
|
|||||||
|
|||
|
c++
can a constructor be virtual
|
| The Following 3 Users Say Thank You to Arpan1987 For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: c++
No constructors can not be virtual but destructors can be virtual.
|
| The Following User Says Thank You to swetha_joein For This Useful Post: | ||
|
|||
|
Re: c++
Dear arpan
constructor can not be virtual ,if u declare it as virtual ,1-object can not be create,2-again on dt time v table also not created.3-virtual means dt fun should define in the derive class too but constructor scope is with in a class it can not inherited. |
|
|||
|
Re: c++
No constructor can not be virtual because when u declare a member function as virtual a V-table is created for that class in which the address of this virtual function is stored.. and the constructor initializes this V-table..so if we declare this constructor as virtual then its V-table can not be created... I think u got the point...
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|