Jump to content

Recommended Posts

I have a program (procedural) that when started, instantiates a couple of different classes (class A and class B). My question is, is it possible to access class A from class B, or do I have to instantiate class A again in class B?

 

Thanks for any help

 

Sorry this topic is in the wrong area, I thought I had navigated back from the regex forum when I started the topic

Link to comment
https://forums.phpfreaks.com/topic/160159-class-scope/
Share on other sites

Thank you for your reply.

 

I am working on a program that uses the betfair api. I have a main class which handles all of the requests sent to betfair and does some basic error handling, and this class is started from the main program. I also have a number of other classes which perform functions on market information, but sometimes these other classes need to send a request to betfair (via the main class).

 

                  MAIN PROGRAM
                       /  \
                      /    \
                     /      \
           Main Class       Market Processing Class

 

The main program starts all classes, and then sends a request to betfair for market details via the main class. This data is then passed to the market processing class. However, the market processing class might need to send a request to betfair, and needs to use the main class.

Link to comment
https://forums.phpfreaks.com/topic/160159-class-scope/#findComment-845010
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.