Hi please see the below code
Code:
#include<iostream>
using namespace std;

class OldRectangle{
        int x1,x2,y1,y2;
        public:
        OldRectangle(int a,int b,int c,int d):x1(a),x2(b),y1(c),y2(d)
        {
                cout<<"Old Rectangle"<<endl;
        }
        void oldDraw()
        {
                cout<<"using old drawing method"<<endl;
        }
};

class Rectangle{
        public:
        virtual void draw()=0;
};

class RectangleAdapter : public Rectangle, private OldRectangle{
        public:
        RectangleAdapter(int x,int y,int width, int height):
        OldRectangle(x,y,x+width,y+height)
        {
                cout<<"Initialize the old rectanlge object through this new Rectangle adapter object"<<endl;
        }
        void draw()
        {
                oldDraw();
        }
};

int main()
{
        Rectangle *r= new RectangleAdapter(10,20,33,66);
        r->draw();
        return 0;
}

My question is why we need a RectangleAdapter class.
I can directly write in the main like
OldRectangle *ptr = new OldRectangle(10,20,10+33,20+66);
ptr->oldDraw();

this will do the same thing for me

Please clarify me.

Regards