// The strongly typed collection class.
class Names extends LJCCollectionBase
{
// Adds a string.
// This method makes a string collection strongly typed.
public function Add(string $text)
{
$retItem = $this->AddItem($text);
return $retItem;
}
}
// Gets an indexed array of objects.
private static function GetValues()
{
$names = new Names();
$names->Add("First");
$names->Add("Second");
$names->Add("Third");
$values = $names->GetValues();
$result = join(",", $values);
// result:
// First,Second,Third
}
|