Geeks Talk

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.

c++

This is a discussion on c++ within the C and C++ forums, part of the Software Development category; can a constructor be virtual...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 05-28-2008
Junior Member
 
Join Date: May 2008
Location: India
Posts: 1
Thanks: 0
Thanked 3 Times in 1 Post
Arpan1987 is on a distinguished road
c++

can a constructor be virtual
Reply With Quote
The Following 3 Users Say Thank You to Arpan1987 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 05-29-2008
Junior Member
 
Join Date: Dec 2007
Location: India
Posts: 13
Thanks: 2
Thanked 7 Times in 3 Posts
swetha_joein is on a distinguished road
Re: c++

No constructors can not be virtual but destructors can be virtual.
Reply With Quote
The Following User Says Thank You to swetha_joein For This Useful Post:
  #3 (permalink)  
Old 05-29-2008
Junior Member
 
Join Date: May 2008
Location: india
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
lipune is on a distinguished road
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.
Reply With Quote
  #4 (permalink)  
Old 06-15-2008
Junior Member
 
Join Date: Jun 2008
Location: Bangalore
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sen49 is on a distinguished road
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...
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 09:12 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved