// PL7/galaxy.cpp // The definition of a galaxy on top of the celestial object class // Niels Walet, last updated 04/12/2019 #include #include class celestial_object { protected: std::string name; double mass, distance, luminosity; public: celestial_object() : name{"no-name"}, mass{}, distance{}, luminosity{} {} celestial_object(const std::string nm, const double l, const double m, const double d) : name{nm}, mass{m}, distance{d}, luminosity{l} {} ~celestial_object(){} std::string getname() const {return name;} friend std::ostream& operator<<(std::ostream& , const celestial_object& ); }; class galaxy: public celestial_object { private: std::string hubble_type; public: galaxy() : celestial_object{},hubble_type{"Sc"} {} galaxy(const std::string nm, const double l, const double m, const double d, const std::string ht) : celestial_object{nm,l,m,d}, hubble_type{ht}{} ~galaxy(){} friend std::ostream& operator<<(std::ostream& , const galaxy& ); }; std::ostream& operator<<(std::ostream& o, const galaxy& gx) {o <<" galaxy "<