This is a discussion on problel of design within the Software Patterns forums, part of the Testing category; I have a design problem: I have these classes: app : application res: resource window: gui what I want to make ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
problel of design
I have a design problem:
I have these classes: app : application res: resource window: gui what I want to make is: windows: call a app->getResBmp(FILENAME) ; windows: use string to loadfile but: I would want to find the way to be able to have like return value these: String, Binari, ecc. The solution simpler (but wrong) is a method for every resource and every returned type therefore es: -------------- class app{ res obj:res; } class res{ //two for type of resource string getbmpString(); BYTE getbmpBinary(); string getSoundString(); BYTE getSoundBinary(); ecc. } res delegation to: class bmpResource , class soundResource that they are derived they give class <<interface>>typeRisorce window{ use : //this filename = res->getbmpString(); funcgui->loadfilename(filename) ; //or resource = res->getSoundString(); funcgui->loadfileresource(filename) ; } |
|
|||
|
Re: problel of design
Have you consider using template ?
"yag" <yagyog@tiscali.it> wrote in message news:<qsphd.240251$35.11321442@news4.tin.it>... > I have a design problem: > > I have these classes: > app : application > res: resource > window: gui > > what I want to make is: > windows: call a app->getResBmp(FILENAME) ; > windows: use string to loadfile > > but: > I would want to find the way to be able to have like return value these: > String, Binari, ecc. > > The solution simpler (but wrong) is a method for every resource and > every returned type therefore > > es: > -------------- > > class app{ > res obj:res; > } > > class res{ > //two for type of resource > string getbmpString(); > BYTE getbmpBinary(); > > string getSoundString(); > BYTE getSoundBinary(); > > ecc. > } > > res delegation to: > class bmpResource , class soundResource that they are derived they give > class <<interface>>typeRisorce > > window{ > use : > > //this > filename = res->getbmpString(); > funcgui->loadfilename(filename) ; > //or > resource = res->getSoundString(); > funcgui->loadfileresource(filename) ; > } > > -- |