Скачиваний:
9
Добавлен:
01.05.2014
Размер:
1.14 Кб
Скачать
#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;
Соседние файлы в папке lab2_1