Originally Posted by
mickey
now I don't know.
So maybe you should redesign your classes?
For example like this:
void DOOR::draw( const QImage& img )
{
// ...
}
void build::draw()
{
// ...
for( std::vector<DOOR>::iterator it = door.begin(); it != door.end(); ++it ) {
it->draw( imm );
}
// ...
}
void DOOR::draw( const QImage& img )
{
// ...
}
void build::draw()
{
// ...
for( std::vector<DOOR>::iterator it = door.begin(); it != door.end(); ++it ) {
it->draw( imm );
}
// ...
}
To copy to clipboard, switch view to plain text mode
Other possibility is that each of DOOR instances would hold a pointer or reference to a build instance:
void DOOR::draw()
{
// ...
QImage img
( _build
->image
() );
// ...
}
const QImage& build::image() const
{
return _imm;
}
void DOOR::draw()
{
// ...
QImage img( _build->image() );
// ...
}
const QImage& build::image() const
{
return _imm;
}
To copy to clipboard, switch view to plain text mode
Everything depends on the way you want to use those two classes and on things what they represent.
Bookmarks