Jump to content

calling/referencing methods (oop)


.josh

Recommended Posts

okay i'm (still) an oop noob. I'm just messing around trying to figure out how this whole class thing works.  I guess I'm asking for a few pointers here, on how would I access the methods etc.. here's what my structure looks like so far:

[code]
<?php

class ircBot {
} // end class ircBot 

  class serverInteraction extends ircBot {
  } // end class serverInteraction

  class userInteraction extends ircBot {
      function uIecho() {
        echo "this is an echo from userInteraction class!";
      } // end function uIecho
  } // end class userInteraction

      class chatUserControls extends userInteraction {
        function cUecho () {
            echo "this is an echo from chatUserControls class!";
        } // end function cUecho
      } // end class chatUserControls

      class adminControls extends userInteraction {
      } // end class adminControls

        class botAdminControls extends adminControls {
            function bAecho () {
              echo "this is an echo from botAdminControls class!";
            } // end function bAecho
        } // end class botAdminControls

        class chatOperControls extends adminControls {
        } // end class chatOpercontrols


$crayonBot = new ircBot;
// okay now how would i echo each of those strings?
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/27253-callingreferencing-methods-oop/
Share on other sites

you got it backwards there........when you extend a class it just means your essentially including the class and all it's properties
not adding on to it......

so in your case, when you extend ircbot, you're not really including anything at all

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.