Private property right is one of the most important rights that facilitates the growth of any society. Capitalism and other "ism" may very well not exist if private property rights do not exist, while some ideologies protect private property rights more than other, everyone can agree that private property rights are somewhat important. Another dicey subject surrounding property rights is the subject of inheritance, some believe property rights should die with the owner of the said property while their property falls into the hands of the state while others believe in the transfer of wealth. Now that we're done with the preamble, let's see how it relates to technology.
A RELATABLE EXPLANATION
When building software solutions, we sometimes make use of inheritance. A lot of times, data is nested within some classes or properties (just think of this as some part of the program), when we create a class (think of this as another component of the program), we're able to reach into the pockets of the other classes through inheritance. There are however rules that inheritance must play by and these rules are similar to how things work in the real world. One of the important rules to remember is that a child class can inherit from a parent class and have access to all the properties of the parent class.
COMMON RULES OF USING INHERITANCE
On the other hand, a parent class can't have access to the properties of a child class, even in reality, parents hardly ever know everything their children own, the children are more likely to know (and use) the assets of the parents though ๐. Another rule that is worth mentioning is that one can't try to trick the system by making the parent inherit from the child class, the child class is only referred to as a child class because it inherits from a class (that we then refer to as the parent class).
Trying to inherit from the child class creates an endless cycle which is why it's not allowed. There are however times when the parent needs to obtain data from the child class because more often than not, child classes exist to manipulate parent data in a specific way and return the result of that manipulation to the parent. Doing all the manipulation within the parent class would make the parent class very hard to manage in the long run as there would be too many lines of code within that class, this is why we ensure that parent classes must have children.
FINALLY
To pass the data back to the parent class, we have several tricks, however, arguably the most embraced is one where we create a variable (which is like a container) to house the result of the manipulations, then we equate the variable to the property of the parent we're trying to pass data to and thus we send the information across the fence ๐ . All of these may sound somewhat alien if you've not written code that uses inheritance, however, beneath most websites and applications you use, this technique is used to ensure that data moves from one part of the application to another, sometimes from a class to the database.