Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 970281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:46:46+00:00 2026-05-16T02:46:46+00:00

In my project, say I am instantiating a class named SubClass , which extends

  • 0

In my project, say I am instantiating a class named SubClass, which extends an abstract class named AbstractClass. At the top of my files I include a file named bootstrap.inc, which includes AbstractClass in every file. Then, when I need it, I include SubClass which does not contain an include to AbstractClass.

If I include AbstractClass in the files of classes that extend it (such as SubClass), sometimes I am using multiple sub-classes in one file and will get an error. I would rather not include AbstractClass in every file via the bootstrap, since I am not always using it, but cannot think of a way to avoid this.

I have been advised that using include_once() is a sign of poor design, so have avoided that, although it would be one solution.

Is there an alternative method to include_once()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:46:47+00:00Added an answer on May 16, 2026 at 2:46 am

    First off – it’s generally a good idea to stick to one class per file. If you’re worried about performance, you’re being paranoid. In production, you can always turn on APC with stat off.

    Secondly – there’s nothing wrong with include_once/require_once.

    Unless you’re going to set up some fancy autoloading magic, just stick to one class per file.

    Absent some specific concern (that is, something articulable that you actually understand, not just some rumor you heard), the following pattern is perfectly fine:

    <?PHP
    require_once 'MyAbstract.class.php';
    
    class Concrete extends MyAbstract {
     //...
    }
    // end-of-file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Summary: Say I have a project in Django called devsite which will be deployed
when I build my project in release mode, right click the project and say
Say if we have a project known as main , and then we have
Say I've got a project under git version control. Within that project, I have
This should be simple. Question How do you get a pointcut in one project
Anyone have any good tips on handling differences in web.config settings between environments? I've
This is a relatively open question. If I have built an application in a
I'm attempting to dynamically register entities and configurations with a context (ef4 code-only) I
I just started learning Zend. I managed to get the basic working (using zf
I don't know if I totally got the concept wrong, but I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.