#include<iostream>
using namespace std;
class Square;
class Rectangle {
public:
int height;
int width;
void area() {
cout << height*width << endl;
}
void convert(Square object);
};
class Square {
private:
friend class Rectangle;
float side;
public:
Square(int x) {
side = x;
}
};
void Rectangle::convert( Square object ) {
height = object.side;
width = object.side;
}
int main() {
Rectangle r;
Square s(5);
r.convert(s);
r.area();
}
Created
March 13, 2019 15:44
-
-
Save hasinur1997/e368ba90b578cee94d71f74f28f2edd7 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice Work 👍