Fwd: [PHP] Interface OOP
| From: | Andrew Williams | Date: | Mon, 09 Feb 2009 15:46:03 +0000 |
| Subject: | Fwd: [PHP] Interface OOP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287968@lists.php.net to get a copy of this message | ||
Hi,
I am working on a back end OOP project with about about 18 classes of Object
but some of the Objects shear one or two functions in common, like external
login system . What is the best way to avoid a repeatable function among the
classes without using global object instance.
class a{
function ExtractRawData()
{
global loginObj;
*if($loginObj;->GetLoginSession(){*
///process
}
}
}
class b{
function JohnXchange()
{
global loginObj;
*if($loginObj;->GetLoginSession(){*
///process
}
}
}
class login(
function loginSession($pwd, $acc, $customerAcc)
{
$this ->validate = connect to externalServerObject($pwd, $acc,
$customerAcc);
}
*GetLoginSession()*
{
return $this ->validate;
}
}
Andrew Williams
http//www.willandy.co.uk
--
Best Wishes
Andrew Williams