<?php

class Class_1
{
private $Text;

function __construct($Text)
	{
	$this->Text = $Text;
	}

function Set($Text)
	{
	$this->Text = $Text;
	}

function Display()
	{
	print $this->Text . "\n";
	}
}			// End Class_1

class Class_2
{
private $Text;
private $C1;

function __construct($Text)
	{
	$this->Text = $Text;

	$this->C1 = new Class_1('From David');
	}

function Set_C1($Text)
	{
	$this->C1->Set($Text);
	}

function Display()
	{
	print $this->Text . "\n";
	$this->C1->Display();
	}
}			// End Class_2

print "Below is T1\n";

$T1 = new Class_1('Hello');
$T1->Display();

print "Below is T2\n";
$T2 = new Class_2('World');
$T2->Display();

print "Copying T2\n";

$T3 = $T2;

print "T2 Copied, original value is :-\n";

$T2->Display();

print "Copy of T2 (T3) value is :- \n";

$T3->Display();

print "Changing T3\n";

$T3->Set_C1("This clears Dave");

print "T3 Change complete, new value is :-\n";

$T3->Display();

print "Below is T2 which shouldn't have changed !!! \n";

$T2->Display();

// var_dump($T1);

?>

