Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Tile.cpp
- ///
- ///Copy-constructor using other Tile-object
- ///@param other - the object to be copied
- Tile::Tile(Tile const& other)
- {
- // TODO: write a deep copy constructor
- tileLocation = new Point(other.GetLocation());
- tileType = other.GetTileType();
- isStacked = other.IsStacked();
- roomNumber = other.GetRoomNumber();
- }
- ------
- //Point.cpp
- ///
- ///Constructs a new Point-object using other Point-object
- ///@param other - the object to be copied into this object
- ///
- Point::Point(const Point& other)
- {
- this->x = other.GetX();
- this->y = other.GetY();
- }
- ///
- ///Constructs new Point-object using other Point-object via pointer
- ///@param other - the pointer to other object to be copied into this object
- ///
- Point::Point(const Point* other){
- this->x = other->GetX();
- this->y = other->GetY();
- }
- ///
- ///Overloaded assignment operator, copies the values of other Point-object into this object
- ///@param rhs - the object to be copied here
- ///
- Point& Point::operator=(const Point& rhs)
- {
- if (this == &rhs) return *this; // handle self assignment
- return *this;
- //assignment operator
- this->x = rhs.GetX();
- this->y = rhs.GetY();
- return *this;
- }
- -------
- error: passing 'const Tile' as 'this' argument of 'Point* Tile::GetLocation()' discards qualifiers
- error: passing 'const Tile' as 'this' argument of 'Tile_Types::tile_t Tile::GetTileType()' discards qualifiers
- error: passing 'const Tile' as 'this' argument of 'bool Tile::IsStacked()' discards qualifiers
Add Comment
Please, Sign In to add comment