Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 11 / lab1_3 / Text
.cpp#include "stdafx.h"
#include "Text.h"
#include "Shape.h"
Text::Text(string text): id(++total){
count++;
cout << "create Text#" << id << endl;
this->text = text;
}
Text::Text(const Text* o): id(++total){
count++;
cout << "create Text#" << id << " via cc" << endl;
this->text = o->text;
}
Text::Text(const Text& o): id(++total){
count++;
cout << "create Text#" << id << " via cc" << endl;
this->text = o.text;
}
Text::~Text(){
count--;
cout << "destroy Text#" << id << endl;
}
void Text::setText(const string& s){
text = s;
}
string Text::getText(){
return text;
}
ostream& Text::print(ostream& os) const{
os << "Text#" << id << ": " << toString();
return os;
}
Text& Text::operator= (const Text& o){
if(this == &o)
return *this;
this->text = o.text;
return *this;
}
void Text::moveBy(const double x, const double y){
}
string Text::toString() const {
return text;
}
int Text::operator==(const Text& o) const {
return (text == o.text);
};
// initialize static fields
unsigned long int Text::count = 0;
unsigned long int Text::total = 0;
Соседние файлы в папке lab1_3