Thread: virtual constuctor vs virtual distructor

  1. #1
    Registered User
    Join Date
    Nov 2006

    virtual constuctor vs virtual distructor

    Hi everbody!

    Can anyone proper explain me the concept of virtual constructor and virtual distructor.

    I will be very thankful if explained with the help of example...



  2. #2
    Registered User
    Join Date
    May 2003
    The simplest difference is a virtual constructor doesn't exist.

    A virtual destructor does.

    In general, if your class is going to be the parent of any child class, you NEED a virtual destructor. Just put "virtual" before the destructor.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Seattle, WA
    There's technically no such thing as a virtual constructor in C++. I'd suggest reading: and the entry below it
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual Box
    By ssharish2005 in forum Tech Board
    Replies: 3
    Last Post: 02-12-2009, 05:08 AM
  2. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  3. Program with Shapes using Virtual Functions
    By goron350 in forum C++ Programming
    Replies: 12
    Last Post: 07-17-2005, 01:42 PM
  4. C++ XML Class
    By edwardtisdale in forum C++ Programming
    Replies: 0
    Last Post: 12-10-2001, 11:14 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM