Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication38.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
- //
- #include <iostream>
- using namespace std;
- class Point
- {
- protected:
- double x, y;
- public:
- Point()
- {
- x = y = 0;
- }
- Point(double x, double y)
- {
- this->x = x;
- this->y = y;
- }
- };
- class Cirlce:public Point
- {
- private:
- double r;
- public:
- Cirlce() :Point()
- {
- r = 0;
- }
- Cirlce(double x, double y, double r) :Point(x,y)
- {
- this->r = r;
- }
- friend ostream& operator<<(ostream& out, Cirlce& circle)
- {
- out << "Center = [" << circle.x <<";"<< circle.y<<"];" << "Radius ="<<circle.r << endl;
- return out;
- }
- };
- int main()
- {
- Cirlce circle(2, 3, 4);
- cout << circle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement