Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions