tags:

views:

73

answers:

0

Possible Duplicate:
Do the parentheses after the type name make a difference with new?

What is the difference between the following : Foo* a=new Foo; and Foo* b=new Foo(); in the following code? Can anyone tell me what exactly happens when these two statements are executed?

#include <iostream>

using namespace std;

class Foo {
int i;
public:
  Foo() {i=5; cout << i << endl;}
};

int main() {

Foo* a=new Foo;
Foo* b=new Foo();
return 0;

}