Jump to content


Photo

OOP scope issues (I think)


  • Please log in to reply
2 replies to this topic

#1 niihon

niihon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 May 2006 - 05:55 PM

First off- I want to thank everyone for thier help - I really appreciate it.

I have three class A B C- B extends A - C extends B-

I am able to call functions from A from B, when i call functions from A from C i get this error:

Fatal error: Cannot redeclare class A in /home/techdoco/public_html/A.class.php on line 8

Line 8 is the declaration of class A in A.class.php

I went through all my code and removed the $this and replaced with :: (ie. A::function). Still getting this error.

Any ideas?


Thanks again



#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 29 May 2006 - 06:21 PM

Sounds as though you are redeclaring class A which has already been declaired. Really hard to see without code, and I imagine the code is to big to paste.

How are you including these classes together? Make sure your using include_once(), this prevents a class from being included twice.

#3 niihon

niihon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 May 2006 - 06:48 PM

include_once() worked - thanks i really appreciate it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users