small questions.

Discussion in 'C++' started by mmondal71, May 30, 2010.

  1. mmondal71

    mmondal71 New Member

    Joined:
    May 25, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    What about Virtual Destructor?
    What is Pure Virtual Function? Why and when it is used ?
    i m new to this.please answer if u can.
     
  2. pkbis28

    pkbis28 New Member

    Joined:
    May 25, 2010
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Yes there is a Virtual Destructor. A destructor can be virtual as it is possible as at runtime depending on the type of object pointer is pointing to , proper destructor will be called.
    i dont know pure virtual function.
     
  3. spoddar66

    spoddar66 New Member

    Joined:
    May 25, 2010
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    The abstract class whose pure virtual method has to be implemented by all the classes which derive on these. Otherwise it would result in a compilation error.
     
  4. mmondal71

    mmondal71 New Member

    Joined:
    May 25, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    will someone clarify the virtual function?
     
  5. pkbis28

    pkbis28 New Member

    Joined:
    May 25, 2010
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    A pure virtual function does not work at all - it is by definition defined as a a header only, with zero assigned to indicate this to the compiler (and developer).

    The effect is that you are unable to create an instance of a class which contains a pure virtual function, and such a class is refered to as abstract.

    The use of such a class is as a base class which defines the common functionality which descendant classes must implement if they are to be instanciated.
    This is all i got abt pure virtual function.
     
  6. pankaj.sea

    pankaj.sea New Member

    Joined:
    Apr 6, 2009
    Messages:
    461
    Likes Received:
    13
    Trophy Points:
    0
    Occupation:
    Web Developer
    Location:
    Kolkata
    Home Page:
    http://ipankaj.net
    nice declaration!
    :)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice