Afficher un message
Vieux 18/09/2007, 05h58   #1
Sanders Kaufman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Recursion(?) in My Class

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);
}
}
(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?


  Réponse avec citation
 
Page generated in 0,05283 seconds with 9 queries