c++ - Design for interaction of child classes -
I have some hints below the design problem.
Suppose I want to write some classes to calculate USB devices and select special equipment and transmit data through it for different platforms. (Just a very basic scenario. More of a design question than anything related to US).
Now I have to be an instrument base class for USB devices, which can get functions such as ENRAT_DEVISES on the basis of string etc., etc. Now it will be implemented differently on different platforms. So maybe I will have some child classes that can implement it using platform specific APIs.
The other categories I want to now have some buffer squares which will transfer the data to the USB endpoint. It will be required to be implemented by different platforms again on the basis of providing APIs.
Now suppose I am creating a Windows based USB device class and a buffer class and using those windows have implemented those who provide APIS. My question is, what should I do if my Windows buffer class needs some data from my Windows device class? What type of pattern can I use so that the basic classes are anonymous for internal intermediate platform-based structures used in child classes and buffer classes can use special data members? Want to get a good design for this? Do not know that I am quite clear in writing. Hope to get some insights
EDIT: I know factory and intangible factories. This is not related to them. I can not access the child class member function through the factory pattern through an object of UsbDevice *
Brief Profile
SomeWindowsUsbDevice:. Public UsbDevice {Public: Zero findDevices () {// Not only in the base class / code, to find devices using a child class function platform API. // fills two private structures below} Private: DevEnum * pdevenum; // Some platform specific structures Buffsize * pbufsize; // Some platform specific structure} SomeWindowsUsbDataTrf: Public UsbDataTrf {public: DevEnum * getdevicelist () {// SomeWindowsUsbDevice :: pdevenum is required to access} Buffsize * getbuffsize ()} {// get access to someWindowsUsbDevice :: pdevenum Try to do endpoint re-directing, more information is available
P> I also recommend you to read the factory patterns, you will find out why it is suggested Or that only Google factory patterns and you'll have a long description
Comments
Post a Comment