 
        
        
          Добавил:
          
          
        
        
    
            Studfiles2
            
            
            
            
            
            Опубликованный материал нарушает ваши авторские права? Сообщите нам.
          
          Вуз:
          Предмет:
          Файл:Лабораторная работа 1 / lab_1 / Shape
.cpp// Copyright (C) 1991 - 1999 Rational Software Corporation
//////////////////////////////////////////////////////////////////////////
#include "Shape.h"
#include <ostream.h>
//////////////////////////////////////////////////////////////////////////
int Shape::_counter = 0;
//////////////////////////////////////////////////////////////////////////
Shape::Shape(float x, float y)
{
    _id = _counter++;
    _x = x;
    _y = y;
    cout<<"[shape] shape created"<<endl;
}
void Shape::moveToPoint(float x_pos, float y_pos)
{
    _x = x_pos;
    _y = y_pos;
}
const float Shape::get__y() const
{
	return _y;
}
void Shape::set__y(float value)
{
	_y = value;
	return;
}
const float Shape::get__x() const
{
	return _x;
}
void Shape::set__x(float value)
{
	_x = value;
	return;
}
Shape::~Shape()
{
    cout<<"[shape] shape destroyed"<<endl;
}
ostream& Shape::speak(ostream& os) const
{
    return os<<"[shape] id="<<_id<<", shape center coordinates: ("
             <<_x<<", "<<_y<<"), "
             <<"area = "<<Area()<<endl;
}
bool Shape::operator==(const Shape& rhs) const
{
    // учитывая проверку при создании объектов,
    //  достаточно сравнить идентификаторы
    return (_id == rhs._id);
}
//////////////////////////////////////////////////////////////////////////
ostream& operator<<( ostream& o, const Shape& rhs )
{
    return rhs.speak(o);
}
//////////////////////////////////////////////////////////////////////////
          Соседние файлы в папке lab_1
          
      
    
    
    
          