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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:57:54+00:00 2026-06-05T07:57:54+00:00

I have been tinkering around with OOP and seeing how to go about doing

  • 0

I have been tinkering around with OOP and seeing how to go about doing this. I have parent class that does stuff and sets values to its own properties. Then I want to create a child class that extends the parent while “somehow” accessing the dynamically modified properties. I was wondering if this could be done with a proxy of some sort. Im still learning so i’m not 100% sure on the OOP strategies here.

class Parent
{
    public $test;

    public function boot()
    {
        // boot stuff
        $this->internalStuff();
    }

    public function internalStuff()
    {
        $this->test = 'World!';
        $c = new Child();
        $c->cTest();
    }
}

$p = new Parent;
$p->boot();


class Child extends Parent
{
     public function __construct()
     {}

     public function cTest()
     {
         echo 'Hello ' . $this->test;
     }
}
  • 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-05T07:57:56+00:00Added an answer on June 5, 2026 at 7:57 am

    Inheritance (parent/child relationships between classes) only extends to the class definition. I.e. what methods and properties a class has. It only defines the “blueprint” of a class. The actual values are assigned to object instances of the class. You cannot modify the inheritance of an instantiated object. Neither does one object magically take over the values of another object, regardless of how their parent/child relationship is.

    So no, it just doesn’t work that way. If you want a Child object to have certain values, you need to assign them to an instance of that object. Whatever you did with a completely different object instance of another class doesn’t matter.

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

Sidebar

Related Questions

I have been tinkering around with ServiceStack to expose some web services and have
I am completely new to Batch files and have been tinkering around with simple
I have been tinkering around with PDF::API2 and i am facing a problem, create
Greetings stackoverflow. I have been tinkering about with a SOAP client using PHP5's native
I've been tinkering around with Python lately and wanted to make a GUI that
I have a routing question that i have been tinkering with but have been
I have recently been tinkering around with C# to C++ interop, in particularly setting
I have seen this on a program that I am tinkering: static const void
I have been tinkering with javasript (jquery) all day. I want to create a
Have been working on this question for a couple hours and have come close

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.