Redefining PHP Classes

Reply

Join Date: Jun 2009
Posts: 6
Reputation: gilbertsavier is an unknown quantity at this point 
Solved Threads: 0
gilbertsavier gilbertsavier is offline Offline
Newbie Poster

Redefining PHP Classes

 
0
  #1
Aug 14th, 2009
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++.

  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.
Thanks & regards
Lokananth
[url "http://www.mioot.com"]Live Chat Software[/url] By miOOt
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,466
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: Redefining PHP Classes

 
1
  #2
Aug 14th, 2009
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.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC