Vidyalelo
C++ Programming · Q45

Classes and Objects in C++

Programming · C++ Programming · question 45

Q45

What will be the output of the following C++ code? #include #include using namespace std; class Box int capacity; bool operator capacity capacity = capacity; ; int main(int argc, char const *argv[]) Box b1(10); Box b2 = Box(14); if(b1 < b2) cout<<"Box 2 has large capacity."; else cout<<"Box 1 has large capacity."; return 0;

A.
Error
Answer
B.
Segmentation fault
C.
Box 2 has large capacity
D.
No output

Answer: Option A

Solution

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