Vidyalelo
C++ Programming · Q178

Classes and Objects in C++

Programming · C++ Programming · question 178

Q178

What will be the output of the following C++ code? #include #include using namespace std; class Box int capacity; Box() Box(double capacity) this->capacity = capacity; ; int main(int argc, char const *argv[]) Box b1(10); Box b2 = Box(14); return 0;

A.
Error
Answer
B.
Segmentation fault
C.
4
D.
No output

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board