Call Functions Of Remote Class (OOP, CLI)
Posted: Tue Jun 01, 2010 4:52 pm
I'm not really sure how to explain my situation, but I'll do my best...
As it stands, I'm new to OOP. What I have is the following...
I have the following function inside of class IRC
and the following function inside of Core
As you can see, I want the function inside of Core to write to the socket via the function Write...
But when I do, it gets the following error:
Notice: Undefined property: Core::$Connection in /syebot/bot/class_IRC.php on line 33
Warning: fwrite(): supplied argument is not a valid stream resource in /syebot/bot/class_IRC.php on line 33
For some reason, it's trying to call the write command as Core:: when it should be calling it as IRC::
If you need me to further explain this, please let me know.
Thanks,
Syekiya
As it stands, I'm new to OOP. What I have is the following...
Code: Select all
Class IRC
Class ModuleSystem
Class Core extends ModuleSystemI have the following function inside of class IRC
Code: Select all
public function Write($Data) {
fwrite($this->Connection, $Data);
}and the following function inside of Core
Code: Select all
public function PassInfo($Command) {
if ($Command == ":!test") {
IRC::Write($Data = "PRIVMSG #SyeBot: Test!");
}
}As you can see, I want the function inside of Core to write to the socket via the function Write...
But when I do, it gets the following error:
Notice: Undefined property: Core::$Connection in /syebot/bot/class_IRC.php on line 33
Warning: fwrite(): supplied argument is not a valid stream resource in /syebot/bot/class_IRC.php on line 33
For some reason, it's trying to call the write command as Core:: when it should be calling it as IRC::
If you need me to further explain this, please let me know.
Thanks,
Syekiya