File:  [Research Unix] / researchv10no / cmd / cfront / libstring / test18.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

#include "String.h"

struct Foo {
		Foo() {}
		Foo(Foo& x) { *this = x; }
		~Foo() {}
	Foo&	operator=(Foo& x) { s[0] = x.s[0]; s[1] = x.s[1]; return *this; }
	String	s[2];
};

Foo
zot(Foo x)
{
	x.s[0] += "zot";
	x.s[1] += "zotzot";
	return x;
}

ostream&
operator<<(ostream& o, Foo& x)
{
	return o << "Foo::s[*]: " << x.s[0] << " " << x.s[1];
}

main()
{
	Foo	x;
	x.s[0] = "hello";
	x.s[1] = "hello";
	cout << zot(x) << "\n";
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.