new foo -vs- new foo()

Discussion in 'C++' started by Robert Allan Schwartz, Aug 11, 2004.

  1. Given:
    class foo { };

    What is the difference between:

    new foo

    and

    new foo()

    ?

    When would I use the first form, when would I use the second form, and
    why are there two different forms for what is apparently the same
    thing?

    Thanks,

    Robert Schwartz
    Robert Allan Schwartz, Aug 11, 2004
    #1
    1. Advertising

  2. Robert Allan Schwartz

    Alex Vinokur Guest

    "Robert Allan Schwartz" <> wrote in message news:...
    > Given:
    > class foo { };
    >
    > What is the difference between:
    >
    > new foo
    >
    > and
    >
    > new foo()
    >
    > ?
    >
    > When would I use the first form, when would I use the second form, and
    > why are there two different forms for what is apparently the same
    > thing?
    >
    > Thanks,
    >
    > Robert Schwartz


    See the thread titled "new X vs new X() "
    at http://groups.google.com/groups?threadm=


    \
    --
    Alex Vinokur
    http://mathforum.org/library/view/10978.html
    http://sourceforge.net/users/alexvn
    Alex Vinokur, Aug 11, 2004
    #2
    1. Advertising

  3. Robert Allan Schwartz

    marbac Guest

    marbac, Aug 12, 2004
    #3
    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. Replies:
    3
    Views:
    371
    John Roth
    Jul 29, 2005
  2. .rhavin grobert

    vector: Foo[5] == ((foo*)Foo) + 5 ?

    .rhavin grobert, Sep 23, 2008, in forum: C++
    Replies:
    4
    Views:
    377
    JaredGrubb
    Sep 24, 2008
  3. Brandon Dimcheff
    Replies:
    2
    Views:
    135
    Brandon Dimcheff
    Oct 7, 2008
  4. Replies:
    1
    Views:
    87
    Richard Cornford
    Jul 12, 2007
  5. Replies:
    4
    Views:
    130
    Thomas 'PointedEars' Lahn
    Dec 23, 2007
Loading...

Share This Page