<?php
class item {
var $name;
var $code;
var $productString;
function Item( $name="item", $code=0 ) {
$this->name = $name;
$this->code = $code;
$this->setName( $name );
}
function getProductString () {
return $this->productString;
}
function setName( $n ) {
$this->name = $n;
$this->productString = $this->name." ".$this->code;
}
function getName () {
return $this->name;
}
}
$item = new Item ("A", 5);
print $item->getProductString ();
?>
|