<?php
namespace Main\Product;

require_once 'Object.php';	// Include the code from package Object.php
									// can be written require_once("Object.php");
									// although it is a language construct not a function

// Import the class Object from the namespace Main
// use \Main\Object as Object;
// A shorthand form equivalent to the above is
use \Main\Object;		

// INHERITANCE ... use the extends keyword.
//
class Product extends  Object
{
	// Attributes
	private $_name;
	private $_price;
	const VAT = 0.15;	// 15/100
	
	// Constructor
	public function __construct($name, $price)
	{
		$this->_name = $name;
		$this->_price = $price;
	}
	
	// Methods for the properties
	// Getters and Setters
	public function GetName()
	{
		return $this->_name;
	}
	
	public function SetName($value)
	{
		$this->_name = $value;
		return;
	}
	
	public function GetPrice()
	{
		return $this->_price;
	}
	
	public function SetPrice($value)
	{
		$this->_price = $value;
		return;
	}	
	
	// Methods
	public function CalculateTax()
	{
		return Product::VAT * $this->_price;	// Calculate tax on price
	}
}
?>