Referring to the sample code above, how do you declare
a numbers object called "A" and assign its "I" member the value "2"?

Q

class numbers {
int I;
public:
void set(int v) {I = v;}
int read() {return I;}
} ;

Referring to the sample code above, how do you declare
a numbers object called "A" and assign its "I" member the value "2"?

1) A : numbers;
A.set(2);

2) numbers set(2);
numbers A;

3) numbers A;
set(2);

4) A.set(2), B.set(3), C.set(5);
numbers A, B, C;

5) numbers A;
A.set(2);

✍: Guest

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

2012-05-01, 3527👍, 0💬