Question
Q1. Write a C++ code that has two classes. (Friend class) First one named Rectangle and has following data members; Length (integer type) Width (integer
Q1. Write a C++ code that has two classes. (Friend class) First one named "Rectangle" and has following data members; Length (integer type) Width (integer type) A constructor to assign Length = 10 and Breadth = 20. > Second class named Rectangle_Area and has following data member; Area (integer type) Functions : void calcArea(Rectangle R) calculates the area of the rectangle using the Length and Breadth values from the other class. void displayArea(Rectangle Rect) displays the length, breadth and area values. Rectangle_Area class should be the friend class of the Rectangle class. In your main function, create objects for two classes and call the functions. SAMPLE RUN: Length : 10 Width : 20 Area : 200
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started