473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 AlbumOptionsView 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 1792
Phil Powell wrote:
class AlbumOptionsView 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
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...
6
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
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...
9
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
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...
166
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
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...
3
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
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...
3
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.