/* Not only connect Usb port, but also connect Type-C port */
class CAdapter : public CUsbDisk, public CTypeCInterface
{
public:
void ConnectDevice()
{
CTypeCInterface::ConnectDevice();
}
};
int main(int argc, char *argv[])
{
CUsbDisk *theDisk = new CAdapter();
theDisk->ConnectDevice();
delete theDisk;
return 0;
} 「对象适配器方式」
/* Connect Usb port */
class CUsbDisk
{
public:
virtual ~CUsbDisk() {}