
- Forum
- Testing
- Software Patterns
- problel of design
problel of design
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 ...
-
11-01-2004, 06:52 AM #1yag Guest
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) ;
}
-
11-14-2004, 03:49 AM #2Ken Loh Guest
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) ;
> }
>
> --

Reply With Quote





