943,723 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 447
  • PHP RSS
Aug 14th, 2009
0

Redefining PHP Classes

Expand Post »
Hey there,

I have a class A that uses class B. Class B also uses class A. This is recursive and am wondering if you can redefine PHP classes like in C++.

PHP Syntax (Toggle Plain Text)
  1. class A{}
  2.  
  3. class B{
  4. private $classA;
  5.  
  6. public function __construct($classA){
  7. $this->classA = $classA;
  8. }
  9.  
  10. public function someFunc(){ echo 'blah'; }
  11. }
  12.  
  13. class A{
  14. private $classB;
  15.  
  16. public function __construct($classB){
  17. $classB->someFunc();
  18. }
  19. }
Last edited by peter_budo; Aug 14th, 2009 at 1:09 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gilbertsavier is offline Offline
6 posts
since Jun 2009
Aug 14th, 2009
1

Re: Redefining PHP Classes

Why not just try it and find out. That's one of the great things with having xampp or wamp/lamp. Because you can easily test it under a localhost environment with that software and I can tell you now, testing that won't crash a your computer unlike calculating pi to 1,000,000 digits using the bcmath library.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Links Partner Finder
Next Thread in PHP Forum Timeline: Help me with users avatar....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC