Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double Entity::getDistanceTo(const Entity& newEntity)
- {
- Point2D *cast2D = dynamic_cast<Point2D*>(this->location);
- Point2D *castTo2D = dynamic_cast<Point2D*>(newEntity.location);
- double distance;
- if (cast2D !=nullptr && castTo2D !=nullptr)
- {
- distance = getDistanceTo2D(newEntity);
- }
- else
- {
- distance = getDistanceTo3D(newEntity);
- }
- return distance;
- }
Advertisement
Add Comment
Please, Sign In to add comment