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

  • SEARCH
  • Home
  • 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 7973863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:13:24+00:00 2026-06-04T08:13:24+00:00

I am a bit new to PHP OOP so I need you guys help

  • 0

I am a bit new to PHP OOP so I need you guys help here. I am trying to understand when to use abstract function inside abstract class.

for example

abstract class User{
    abstract function login();
    //how do I decide if I should make login function as abstract or regular function.              
    abstract function permission();

    function AccountCredit (){
       echo 'show account credits';
    }

}
  • 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-06-04T08:13:26+00:00Added an answer on June 4, 2026 at 8:13 am

    An abstract class is a class that doesn’t ever make sense to actually create (instantiate), like if your classes were “Beagle” and “Terrier”, a “Dog” doesn’t really make sense.

    Color and hairtype would only apply to “Beagle” and “Terrier” but not “Dog”, right? So it would be abstract at the Dog level.

    Any method that only applied to a single breed would just not exist in “Dog” at all.

    numberOfLegs would have an implementation at “Dog” level (not abstract) and the children could just inherit it (by not saying anything about it).

    Note that if you were instantiating actual dogs, the breeds will become abstract–also if you were instantiating actual dogs they might need to overried numberOfLegs to account for individual dogs that have had accidents.

    If you are new to OO, however, may I make a suggestion? Keep all inheritence to a minimum, only do it when you are really forced to. It seems that when a good programmer “Gets” OO their first thought is to link everything into one giant object tree–this turns out not to work very well. You are better off using encapsulation instead of extending nearly every time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to php and trying to write a login function. Bit stuck
I am a bit new to sql and php so I need some help
I am a bit new to yii so I need you guys help. I
I'm very new to php/MySQL and I'm having a bit of trouble. Help would
I am a bit new to php and I need to create a quiz
im new to php and i need a bit of clarification. ive searched google
Hello new to PHP and in a bit of a bind. I need to
Ok guys im a bit stuck here. I usually use jquery to do this
I've done a fair bit of mysql php programming but am pretty new to
I am a bit new to Perl, but here is what 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.