Adapter ਪੈਟਰਨ ਇਜਾਜ਼ਤ ਦਿੰਦਾ ਹੈ ਕਿ ਅਸੰਗਤ ਇੰਟਰਫੇਸ ਵਾਲੇ ਆਬਜੈਕਟ ਇਕ ਦੂਜੇ ਨਾਲ ਕੰਮ ਕਰ ਸਕਣ ਇੱਕ ਦੂਜੇ ਨੂੰ ਲਪੇਟ ਕੇ ਉਸ ਇੰਟਰਫੇਸ ਨੂੰ ਲਾਗੂ ਕਰਕੇ ਜਿਸਦੀ ਦੂਜਾ ਕਾਨੂੰਨਨ ਕਰਦਾ ਹੈ। ਇਹ ਦੋ ਇੰਟਰਫੇਸ ਦੇ ਵਿੱਚ ਇੱਕ ਅਨੁਵਾਦਕ ਦੀ ਤਰ੍ਹਾਂ ਕੰਮ ਕਰਦਾ ਹੈ, ਜੋ ਮੌਜੂਦਾ ਕੋਡ ਵਿੱਚ ਤਬਦੀਲੀ ਕੀਤੇ ਬਿਨਾਂ ਪ੍ਰਬੰਧ ਨੂੰ ਸਮਰੱਥ ਬਣਾਉਂਦਾ ਹੈ।
Adapter ਪੈਟਰਨ ਕੀ ਕਰਦਾ ਹੈ
ADAPTER → convert one interface into another that a client expects (a "translator"):
→ wrap an object whose interface is INCOMPATIBLE, exposing the interface the client needs
→ the adapter translates calls/data between the two interfaces
→ makes incompatible things work together WITHOUT changing either's code
