~cpp
#include <iostream>
using namespace std;

class newstring {
public:
	char *str;

	newstring(char* s)
	{
		str = new char[strlen(s)+1];
		strcpy(str, s);
	}

	int length() const
	{
		return strlen(str);
	}
};

ostream& operator << (ostream& o, const newstring& ns) 
{
	cout << ns.str;
	return o;
}

int main()
{
	const newstring s="123";
	cout << s << "123";
	cout << s.length();
	return 0;
}
Retrieved from http://wiki.zeropage.org/wiki.php/OurMajorLangIsCAndCPlusPlus/2006.2.06/하기웅
last modified 2021-02-07 05:23:57