Question OOP-CTOR-0044
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
class P {
public:
int v;
P() : v(0) { cout << "default "; }
P(int x) : v(x) { cout << "int "; }
};
int main() {
P a;
P b(4);
P c = 7;
P arr[2];
}
- A.
default int default
- B.
int int int default default
- C.
Sign up free to see the answer and a step-by-step explanation.