Page 1 of 1

stupid OOP

Posted: Sat Mar 18, 2006 4:19 pm
by modplod
HI all. I'm realy stuck on this, yet another illogical opp thingy...


I have created a set of objects needed to control my site in index.php, one called configObj which has all the config methods
and one called $secObj which holds some simple security methods,

My problem is how can I acces the meathods within the secObj from a meathod in the configObj, without creating another instance secObj


index.php

Code: Select all

// create new security object
$secObj = new security();
// create a new config object 
$configObj = new config();
configObj, method, how i'm trying to do ot at the moment

Code: Select all

$this->dbPass = $secObj->encrypt($this->dbPass);
$this->dbUser = $secObj->encrypt($this->dbUser);
$this->dbHost = $secObj->encrypt($this->dbHost);
$this->dbName = $secObj->encrypt($this->dbName);
secObj method i'm trying to use (simplyfied)

Code: Select all

function encrypt($string){
		$out = "encrypeted: ".$string;
		return $out;
	}
ps, does it matter that $this->dbHost is a private var withinthe config class?

Posted: Sat Mar 18, 2006 4:59 pm
by feyd
pass the security object to the config object.

Posted: Sat Mar 18, 2006 5:08 pm
by modplod
cool thanks, but how would I go about that?


edit: err I think I just thunk how to do :P