请写出下面代码的类图:#include iostream#include memory 类模式class HeadphoneInterface public virtual void connect const = 0;;class Headphone3_5mm public HeadphoneInterface public void connect const override
+----------------+ +---------------------+
| HeadphoneInterface |<---------| Headphone3_5mm |
+----------------+ +---------------------+
| connect() const | | void connect() const |
+----------------+ +---------------------+
^
|
+----------------+ +---------------------+
| HeadphoneInterface |<---------| Headphone2_5mm |
+----------------+ +---------------------+
| connect() const | | void connect() const |
+----------------+ +---------------------+
^
|
+----------------+ +---------------------+
| HeadphoneInterface |<---------| USBTypeC |
+----------------+ +---------------------+
| connect() const | | void connect() const |
+----------------+ +---------------------+
^
|
+----------------+ +---------------------+
| HeadphoneInterface |<---------| Lighting |
+----------------+ +---------------------+
| connect() const | | void connect() const |
+----------------+ +---------------------+
^
|
+-------------------+ +-------------------+
| InterfaceConverter | | std::shared_ptr
原文地址: https://www.cveoy.top/t/topic/hjp7 著作权归作者所有。请勿转载和采集!