Referring to the sample code above, which one
of the numbered lines of code is legal C++?

Q

class Foo {
int i;
public:
Foo(int x) : i(x) { }
};

1: Foo *f = new Foo;
2: Foo &f = new Foo(1);
3: int i = Foo::i;
4: Foo *af = new Foo[10];
5: const Foo &af = Foo(1);

Referring to the sample code above, which one
of the numbered lines of code is legal C++?
1) Line 1
2) Line 2
3) Line 3
4) Line 4
5) Line 5

✍: Guest

A
(This question has not been answered yet. If you know the answer, please share it in a comment below.)

2012-04-27, 4436👍, 0💬