#include &lt;iostream&gt;    using namespace std;    class sample;    class sample1     &#123;        int width, height;        public:        int area &#40;&#41;        &#123;            return &#40;width * height&#41;;&#125;            void convert &#40;sample a&#41;;        &#125;;    class sample     &#123;        private:        int side;        public:        void set_side &#40;int a&#41;        &#123;             side = a;        &#125;        friend class sample1;    &#125;;    void sample1::convert &#40;sample a&#41;     &#123;        width = a.side;        height = a.side;    &#125;    int main &#40;&#41;     &#123;        sample sqr;        sample1 rect;        sqr.set_side&#40;6&#41;;        rect.convert&#40;sqr&#41;;        cout &lt;&lt; rect.area&#40;&#41;;        return 0;    &#125;
A. 24
B. 35
C. 16
D. 36
Answer:A
#include &lt;iostream&gt;    using namespace std;    class sample;    class sample1     &#123;        int width, height;        public:        int area &#40;&#41;        &#123;            return &#40;width * height&#41;;&#125;            void convert &#40;sample a&#41;;        &#125;;    class sample     &#123;        private:        int side;        public:        void set_side &#40;int a&#41;        &#123;             side = a;        &#125;        friend class sample1;    &#125;;    void sample1::convert &#40;sample a&#41;     &#123;        width = a.side;        height = a.side;    &#125;    int main &#40;&#41;     &#123;        sample sqr;        sample1 rect;        sqr.set_side&#40;6&#41;;        rect.convert&#40;sqr&#41;;        cout &lt;&lt; rect.area&#40;&#41;;        return 0;    &#125;
A. 24 B. 35 C. 16 D. 36
Explanation:In this program, we are using the friend for the class and calculating the area of the square.