473,659 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP class inheritance bug?

http://www.phpbuilder.com/board/show...2#post10541092

I can't explain it better than to show you my thread

Environments: PHP 4.1.2 and 4.3.2

Scenario:

I have a script ../classes.inc.php which serves as a "JAR" file of PHP
classes that pertain to the entire application at application-level
scope. The script consists of about 25 different classes, of which
any class that extends OptionsView fails and produces this error:

Fatal error: Class fooview: Cannot inherit from undefined class
optionsview in /classes/classes.inc.php in line 2836

Here is code that consists of line 2836:

[PHP]

class AlbumOptionsVie w extends PaginationView { // THIS ONE IS JUST
FINE!

}

class FooView extends OptionsView { // BOMBS THIS IS LINE 2836

}

class OptionsView extends PaginationView {

}

class BlahView extends OptionsView { // THIS ONE IS JUST FINE

}

class Blah2View extends PaginationView { // THIS ONE IS FINE TOO!

}

class PaginationView extends View {

}
[/PHP]
However, if any class exists *physically placed after* OptionsView in
the script, and it extends OptionsView, everything is ok.

NOTE: This does not occur with any other class. If any class extends
any other class in the same script, no matter where it's placed,
everything is just fine.

I went so far as to literally strip out all code from OptionsView - to
no avail, same error.
Jul 17 '05 #1
1 1805
Phil Powell wrote:
class AlbumOptionsVie w extends PaginationView { // THIS ONE IS JUST
FINE!

}

class FooView extends OptionsView { // BOMBS THIS IS LINE 2836

}

class OptionsView extends PaginationView {

}


Define OptionsView *before* FooView.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3232
by: Ricky Romaya | last post by:
Hi, Are there any ways to get multiple inheritace in PHP4? For example, I have 3 parent class, class A, B, and C. I want class X to inherit all those 3 classes. Consider merging those 3 classes is out of the question, as there are class Y which only inherits from class A, etc. TIA
6
3189
by: Brian Jones | last post by:
I'm sure the solution may be obvious, but this problem is driving me mad. The following is my code: class a(object): mastervar = def __init__(self): print 'called a'
22
5827
by: Marcin Vorbrodt | last post by:
Taken out of C++ In a Nutshell book... Example 7-18: Using an abstract classes as interface specification. struct Runnable { virtual void run() = 0; }; struct Hashable { virtual size_t hash() = 0; };
9
5877
by: mead | last post by:
What kind of classes is qualified as "concrete classes"? When should a member function in a class defined as "pure virtual" and when as "virtual"? Thanks!
4
4011
by: KInd | last post by:
Hello All, When is nested class more preferable that Inheritance ? I think with proper inheritance and friend class concept we can get the same flexibility as nested classes Any comments .. Best Regards KInd --
166
8597
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
11
2866
by: Darren.Ratcliffe | last post by:
Hi guys Posted what was probably a rather confusing post about this the other day, so I am going to have another go and see if I can make more sense. This sis purely a I've got a base class called animal, and from within animal you can access lots more classes such as feline, canine, reptile and amphibian.....
3
2237
by: hurcan solter | last post by:
Consider the code fragment; class A { public: A(){} A(int prm):mprm(prm){} int mprm; }; class B:public A {
3
1581
by: Jam | last post by:
Hello All, Your comment is needed on following subject,i define the Class and Inheritance as following,what do you think? Class: Class is a set of objects which shares common states and behaviors,Class can contain subclasses. Inheritance: if two classes are having two common states and behaviors or if a class is derived from another class it is called Inheritance, All's comment is needed,is this defination ok or something more should
3
1662
by: Ravi | last post by:
Is this the correct way to think of "base class"? The "base class" is a class from which other classes are derived. The "base class" will never be derived from another class.
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.