Esempio n. 1
0
int main()
{
	Mem mem;
	cout << mem.moved() << endl;
	mem.pointer(1);
	cout << mem.moved() << endl;

	MyString s("My test string");
	s.print(cout);
	s.concat(" some additional stuff");
	s.print(cout);
	MyString s2;
	s2.concat("Using default constructor");
	s2.print(cout);
} ///:~
Esempio n. 2
0
void MyString::print(ostream& os)
{
	if (!buf)
		return;
	os << buf->pointer() << endl;
}
Esempio n. 3
0
void MyString::concat(char *str)
{
	if (!buf)
		buf = new Mem;
	strcat((char *) buf->pointer(buf->msize() + strlen(str) + 1), str);
}