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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!