Store values in library

I'll give an example of what I am thinking. Below is a CPP file for the library rectangle. I don't remember where I found this library.

#include "Arduino.h"
#include "rectangle_t.h"
unsigned long SERIAL_BAUD_RATE    = 9600UL;
rectangle_t::rectangle_t(unsigned int const width, unsigned int const height)
: _width(width)
        , _height(height)
    {   }
int rectangle_t::area() const            { return _width * _height; }

void rectangle_t::setWidth(int width)    { _width  = width;  }
void rectangle_t::setHeight(int height)  { _height = height; }

and below this is the H file

#ifndef rectangle_t_h
#define rectangle_t_h


class rectangle_t
{
    unsigned int    _width;
    unsigned int    _height;
 
public:
    // constructor using initializer list, see:
    // <https://isocpp.org/wiki/faq/ctors#init-lists>

    rectangle_t(unsigned int const width, unsigned int const height);

    int area() const;

    void setWidth(int width);
    void setHeight(int height);

};

#endif

So in this library you make a call to rectangle_t(8,7); and it returns 56. What I want to do is made a fuction like rectangel.setWidth(8); and it stores the width in the library, this way a few minutes later you could enter rectangel.setHeight(9); and it will store the value of height. Then a few minutes later you could call rectangel.findAreaOfInfromationStored() and it will return the information you are requesting, without having to declare all a bunch of ints in the part about void setup each time you want to use the library.

Also, if possible, which I am not sure if it is, I was thinking it would also be nice if I call rectangel.clearmemory() which ideally the space of the ints that it stored to be cleared so something else can use them.