Live quiz

cpp - Part 45

Question 1 of 25 Hints left: 3
Q1

What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class Box { int capacity; public: Box(int cap){ capacity = cap; } friend void show(); }; void Box::show() { Box b(10); cout<<"Value of capacity is: "<<b.capacity<<endl; } int main(int argc, char const *argv[]) { show(); return 0; }

  • A
  • B
  • C
  • D