#ifndef RELATIVISTIC_ROCKET_H #define RELATIVISTIC_ROCKET_H #include //for sqrt #include "rocket.h" using namespace std; class relativistic_rocket: public rocket { public: relativistic_rocket(double initial_length, double initial_v); //speed of light in vacuum (meters per second) static constexpr double c {2.99792458e8}; double length() const override { const double fraction {v() / c}; return rocket::length() * sqrt(1 - fraction * fraction); } }; #endif