12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include "Circle.h"
- #include <iostream>
- #include <fstream>
- //copy-constructor
- Circle::Circle(const Circle& other)
- {
- center = other.center;
- m_radius = other.m_radius;
- }
- Circle::~Circle()
- {
- //???
- }
- double Circle::Get_area()
- {
- return M_PI * m_radius * m_radius;
- }
- bool Circle::operator==(const Circle& other) const
- {
- if(center==other.center && m_radius == other.m_radius)
- {
- return true;
- }
-
- return false;
- }
- std::ostream& operator<<(std::ostream& os, const Circle& circle)
- {
- os << circle.center << " radius: " << circle.m_radius;
- return os;
- }
- Circle& operator>>(std::ifstream& is, Circle& circle)
- {
- char buff[20];
- is >> circle.center;
- is >>buff >> circle.m_radius;
- return circle;
- }
|