#include &lt;iostream&gt;    using namespace std;    class Box    &#123;        double width;        public:        friend void printWidth&#40; Box box &#41;;        void setWidth&#40; double wid &#41;;    &#125;;    void Box::setWidth&#40; double wid &#41;    &#123;        width = wid;    &#125;    void printWidth&#40; Box box &#41;    &#123;        box.width = box.width * 2;        cout &lt;&lt; &quot;Width of box : &quot; &lt;&lt; box.width &lt;&lt; endl;    &#125;    int main&#40; &#41;    &#123;        Box box;        box.setWidth&#40;10.0&#41;;        printWidth&#40; box &#41;;        return 0;   &#125;
A. 40
B. 5
C. 10
D. 20
Answer:A
#include &lt;iostream&gt;    using namespace std;    class Box    &#123;        double width;        public:        friend void printWidth&#40; Box box &#41;;        void setWidth&#40; double wid &#41;;    &#125;;    void Box::setWidth&#40; double wid &#41;    &#123;        width = wid;    &#125;    void printWidth&#40; Box box &#41;    &#123;        box.width = box.width * 2;        cout &lt;&lt; &quot;Width of box : &quot; &lt;&lt; box.width &lt;&lt; endl;    &#125;    int main&#40; &#41;    &#123;        Box box;        box.setWidth&#40;10.0&#41;;        printWidth&#40; box &#41;;        return 0;   &#125;
A. 40 B. 5 C. 10 D. 20
Explanation:We are using the friend function for printwidth and multiplied the width value by 2, So we got the output as 20