Home / MCQ Bank / Computer
Computer Classes And Objects In C Plus Plus Difficulty: Medium

What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class Box{ int capacity; bool operator<(Box b){ return this->capacity < b.capacity ? true : false; } public: Box(){} Box(double capacity){ this->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; }

Select the correct option to test your answer:

More Computer Questions

What is the function of the SUM function in Excel? What will be the output of the following Python function (random module has already been imported)? random.choice('sun') Which of the following technique is faster for travelling in binary trees? In HTML Audio/Video DOM, __________ returns a TextTrackList object representing the available text tracks. What is the purpose of the gemspec file in a Ruby gem?