Reply to Recursion(?) in My Class

Your name:

Reply:


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?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация