pure virtual fxn decl

Discussion in 'C++' started by A man, Sep 22, 2003.

  1. A man

    A man Guest

    Hi,
    what does the assignment " = 0 "
    signify in the pure virtual function declaration

    virtual void f() = 0 ;

    what gets the value "0" ?

    regards,
    Aman .


    --
    Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
    A man, Sep 22, 2003
    #1
    1. Advertising

  2. A man

    WW Guest

    A man wrote:
    > Hi,
    > what does the assignment " = 0 "
    > signify in the pure virtual function declaration
    >
    > virtual void f() = 0 ;
    >
    > what gets the value "0" ?


    Nothing. Nul. Nil. Nada. Zip.

    It means that we declare the function but will not (necessarily) give it a
    body and derived classes are better off override it unless they are abstract
    classes too.

    --
    WW aka Attila
    WW, Sep 22, 2003
    #2
    1. Advertising

  3. A man

    Ron Natalie Guest

    "A man " <> wrote in message news:...
    > Hi,
    > what does the assignment " = 0 "


    Equal signs immediately following declarations aren't assignments, it's an
    initialization.

    > signify in the pure virtual function declaration
    >
    > virtual void f() = 0 ;


    It indicates the function is pure virtual. It's just a hack to use the initialization
    sequence that wouldn't be valid anything to signify the difference between "pure
    virutal" and just "virutal." The other option would be to add a keyword like "pure"
    to the language, which people are reticent to do because adding keywords potentially
    breaks existing programs that might have used that as an identifier. It's painful
    enough dealing with new, delete, and class when moving stuff between C and C++.

    > what gets the value "0" ?


    Nothing really.
    Ron Natalie, Sep 22, 2003
    #3
  4. A man

    Aman Angrish Guest

    Aman Angrish, Sep 22, 2003
    #4
  5. A man

    jeffc Guest

    "A man " <> wrote in message
    news:...
    > Hi,
    > what does the assignment " = 0 "
    > signify in the pure virtual function declaration
    >
    > virtual void f() = 0 ;
    >
    > what gets the value "0" ?


    Nothing. It's just a rather poor way of saying that the function is pure
    virtual.
    jeffc, Sep 22, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan W.

    template static member decl

    Dan W., Apr 29, 2005, in forum: C++
    Replies:
    3
    Views:
    1,775
    Dan W.
    Apr 29, 2005
  2. Patrick Guio

    templates def/decl/mechanism

    Patrick Guio, Nov 21, 2005, in forum: C++
    Replies:
    3
    Views:
    301
    John Harrison
    Nov 22, 2005
  3. Replies:
    5
    Views:
    413
  4. gb345
    Replies:
    4
    Views:
    247
    Michele Simionato
    Nov 9, 2010
  5. noydb
    Replies:
    3
    Views:
    259
Loading...

Share This Page