Referring to the sample code above, which one of the following statements is correct?

Q

class A {
public:
A() {
if(x > 1)
throw "x overflow";
else
x++;
}

private:
static int x;
};

int A::x;

Referring to the sample code above, which
one of the following statements is correct?

1 The class can be instantiated without throwing an exception two times.
2 It cannot be determined how many times the class can be instantiated (unknown value for x).
3 The class can be instantiated without throwing an exception one time.
4 Class A can be instantiated as many times as desired without throwing an exception.
5 Class A can never be instantiated without throwing an exception.

✍: Guest

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

2012-05-07, 4951👍, 0💬