Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Beginner: C++ constructor

Name: Anonymous 2010-09-07 10:10

Hi there!

Is there any difference between new Foo(); and new Foo;?

Name: Anonymous 2010-09-07 10:25

Name: Anonymous 2010-09-07 10:38

>The problem with Foo and Bar is that the C++ grammar is FUBAR.
LOL, this guy is definitely funny!

Thanks, >>2 san

Name: Anonymous 2010-09-07 21:01

As far as I know there is no difference. I use both new Foo(); and new Foo; sporadically in my code with no problems. There may be problems when trying to work with constructors that have overloads ( class Foo{ Foo(){}; Foo(int){};;

Name: Anonymous 2010-09-07 22:00

The () in new Foo(); is there for passing arguments to the constructor.

Even in the cases of new Foo; and new Foo();, the same constructor is called.

Name: Anonymous 2011-02-04 12:18


Don't change these.
Name: Email:
Entire Thread Thread List