Beispiel #1
0
base::base(const base &x)
	// copy constructor:    this := x
{
	// cout << "base::copy constructor for object: " << x << "\n";
	clearself();
#if 0
	if (x.k != x.s_virtual_kind()) {
		x.c_kind(k);
		}
#endif
	// cout << "base::copy constructor, calling copyobject_to()\n";
	const_cast<base &>(x).copyobject_to(*this);
	// cout << "base::copy constructor finished\n";
}
Beispiel #2
0
void base::copyobject_to(base &x)
{
	kind k = s_kind();
	OBJECTSELF s = self;
	
	if (k != BASE) {
		cout << "error: base::copyobject_to() for object of kind " << kind_ascii(k) << endl;
		exit(1);
		}
	cout << "warning: base::copyobject_to() for object: " << *this << "\n";
	x.freeself();
	x.c_kind(k);
	x.self = s;
}
Beispiel #3
0
void base::swap(base &a)
{
	kind k, ka;
	OBJECTSELF s, sa;
	
	k = s_kind();
	ka = a.s_kind();
	s = self;
	sa = a.self;
	c_kind(ka);
	self = sa;
	a.c_kind(k);
	a.self = s;
}