Jump to content

Couple questions on OOP


AdRock

Recommended Posts

Just a couple simple questions on OOP

 

Can you create a new instance of an existing class withing a function of a different class like so? and how would you call a function within the class in another function

 

class MyClass {
    function MyFunction() {
          include_once("MyOtherClass.php");
          $myvar = & new MyOtherClass();

          //how to call MyOtherFunction() here
    }

    function MyOtherFunction() {
        //code for function
    }
}

Link to comment
https://forums.phpfreaks.com/topic/145076-couple-questions-on-oop/
Share on other sites

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.