#include <iostream>
class Rectangle {
private:
int width;
int height;
public:
// Constructor
Rectangle(int w, int h) {
width = w;
height = h;
}
// Member function
int getArea() {
return width * height;
}
};
int main() {
// Creating an object of the Rectangle class
Rectangle rect(4, 5);
// Calling the getArea() function on the object
int area = rect.getArea();
std::cout << "Area: " << area << std::endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: