stupid OOP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
modplod
Forum Commoner
Posts: 45
Joined: Mon Feb 27, 2006 11:18 am

stupid OOP

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

pass the security object to the config object.
modplod
Forum Commoner
Posts: 45
Joined: Mon Feb 27, 2006 11:18 am

Post by modplod »

cool thanks, but how would I go about that?


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