Files
cpp-course/modules/06_oop_basics/src/inheritance.cpp
T

14 lines
488 B
C++

#include "inheritance.hpp"
namespace oop {
Circle::Circle(double radius) : radius_(radius) {}
auto Circle::name() const -> std::string { return "Circle"; }
auto Circle::area() const -> double { return 3.141592653589793 * radius_ * radius_; }
Rectangle::Rectangle(double width, double height) : width_(width), height_(height) {}
auto Rectangle::name() const -> std::string { return "Rectangle"; }
auto Rectangle::area() const -> double { return width_ * height_; }
} // namespace oop