Question OOP-CTOR-0035
EasyWhat is the output of this code?
#include <iostream>
using namespace std;
class Box {
public:
int v;
Box() : v(1) {}
Box(int x) : v(x) {}
};
int main() {
Box a, b(5);
cout << a.v + b.v;
}
- A.
6
- B.
1
- C.
Sign up free to see the answer and a step-by-step explanation.