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 8778167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:27:42+00:00 2026-06-13T19:27:42+00:00

Line : return ‘Static hello ‘ . self::static_user . ‘…<br />’; Produces: Fatal error:

  • 0

Line: return 'Static hello ' . self::static_user . '...<br />';
Produces: Fatal error: Undefined class constant 'static_user' in ....

Note: Logic might be silly but I’m just playing wit it at the moment. Question is how can I access to static variable of abstract class in child class? I can access to public one $public_user with $this->public_user in child class.

abstract class UserAbstract
{
protected $public_user = null;
    static protected $static_user = null;

    public function __construct($name)
    {
    $this->public_user = $name;
        self::$static_user = $name;
    }

    abstract static function static_hello();
}

class User extends UserAbstract
{
    static function static_hello()
    {
        return 'Static hello ' . self::static_user . '...<br />';
    }
}

$obj_user = new User('Voodoo');
echo $obj_user->static_hello();
  • 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-13T19:27:43+00:00Added an answer on June 13, 2026 at 7:27 pm

    Use this:

    return 'Static hello ' . parent::$static_user . '...<br />';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the error Can't convert undefined to object on the line return
after_photo_post_process :post_process_photo def post_process_photo img = EXIFR::JPEG.new(photo.queued_for_write[:original].path) # error on this line return unless
I am receiving an error at this line return folder.SubFolders.Aggregate(count, (current, subfolder) => GetFilesCount(subfolder,
In UML sequence diagram a method can have only one return line (at least
Consider the following: with open(path, mode) as f: return [line for line in f
I know that a command line application should return 0 on success. But are
I'm trying to display the carriage return and line feed in my code but
I'm trying to get the IsAdmin Value with SQL query(This query return 1 line
I have the following line of code for a Windows forms application: return Encoding.ASCII.GetBytes(chars.ToArray());
So evidently: \n = CR (Carriage Return) // Used as a new line character

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.