|
Posted by Sanders Kaufman on 09/18/07 04:58
I'm about to tread on some very thin OOP ice, and I could use a little
In my application, I have a publications class that has both a
"PublicationEditor" and a "PublicationViewer" function.
Since I don't want to confuse the publication I'm viewing, with the
publication that I'm editing, I want to create a new instance of my
Publication Class in the PublicationEditor.
[code]
class Publication() {
var $Title;
var $Content;
funciton Publication() {
$this->Title = "Hello World";
$this->Content= "Goodbye, world!";
}
function GetPublication($iID){
//code to get publication title, content
return true;
}
function SavePublication($iID, $sTitle, $sContent){
//code to get publication title, content
return true;
}
function ViewPublication($iID) {
echo $this->Title;
echo $this->Content;
}
function EditPublication($iID, $sTitle, $sContent) {
$oPub = new Publication();
return $oPub->SavePublication($iID, $sTitle, $sContent);
}
}
[/code]
(The code is seriously dumbed down to represent my question :) )
My question is basically this:
Is there any problem with the way I'm creating a new publication ($oPub)
from within EditPublication, bearing in mind that I know not to call
$oPub->EditPublication?
Navigation:
[Reply to this message]
|