Not sure how to declare
Here's the compiler error
kdtilemapper.cpp:14: error: 'tiles' was not declared in this scope
kdtilemapper.cpp:17: error: 'const class KDTileMapper' has no member named 'tiles'
here is the code in question.
KDTileMapper::KDTileMapper(const KDTileMapper & rhs):TileMapper(rhs,tiles)
{
source = rhs.source;
tiles = rhs.tiles;
}
here is the class
class KDTileMapper : public TileMapper
{
public:
KDTileMapper( const SourceImage & si,const开发者_Go百科 vector<TileImage> & tiles);
~KDTileMapper();
KDTileMapper(const KDTileMapper & rhs & tiles);
KDTileMapper const & operator=(KDTileMapper const & rhs);
int map_tiles(MosaicCanvas & mosaicOut) const;
private:
KDTree<TileImage>* tileMapKDT;
KDTileMapper::KDTileMapper(const KDTileMapper & rhs):TileMapper(rhs,tiles)
You are passing the arguments rhs, tiles
to the base class TileMapper
constructor. But the compiler doesn't know what the identifier tiles
is.
Probably you meant -
KDTileMapper::KDTileMapper(const KDTileMapper & rhs):TileMapper(rhs,rhs.tiles)
// ^^^ newly added.
But the modification is not at all required if you just make the TileMapper
constructor receive just one const argument of type KDTileMapper
by reference because tiles
is already part of the rhs
object ( if it is actually a member variable. But the second error message says it isn't ).
You should put private TILES_TYPE tiles in KDTileMapper class definition or TILES_TYPE tiles in constructor
精彩评论