Hold it, or inherit it?
transcript
You must wrap a vendor's SDK so your code can use it. There are two ways. One of them fails, when the SDK object already exists.
An object adapter has an SDK. It holds a reference, in a field. A class adapter is an SDK. It inherits from the vendor's class.
Start-up builds the SDK. Keys, pool, everything configured. Then it hands the SDK to your adapter. An object adapter just holds it. Nothing to create. Done.
A class adapter is the SDK object. So you create it yourself. So it can't take over one that exists. You can't turn an instance into your subclass. And in Java, the SDK class must not be final.
A class adapter does win sometimes. When you create the SDK yourself. Or when you must override one of its methods. Then it's one object, with no forwarding hop.
Hold the SDK by default. It works in every language. Inherit only when you create it yourself, and may extend it.
Full breakdown in the lecture.