In an oriented tree, the parent is the previous node before the node of interest. The word parent can then be used in countless abstractions of computer science. The container of contained graphic or logic items can be called a parent. The inherited class in OOP can be called the parent.
Questions tagged [parent]
2914 questions
42
votes
7 answers
How to access to the parent object in c#
I have a "meter" class. One property of "meter" is another class called "production".
I need to access to a property of meter class (power rating) from production class by reference. The powerRating is not known at the instantiation of Meter.
How…

Jean Duprez
- 423
- 1
- 4
- 4
38
votes
5 answers
How do I Scroll parent page to top when child page is click within iframe?
When someone clicks on a link within an iframe (child page), how do I get the parent page to scroll to the top? The issue is the child page will remain in the same spot of the page, because the iframe has a lot of height larger than the parent…

Evan
- 3,411
- 7
- 36
- 53
35
votes
3 answers
Call parent Javascript function from inside an iframe
I have a iframe (in my domain), that iframe has a file iframe.js.
My parent document has a file parent.js.
I need to call a function that is in parent.js, from a function that is in iframe.js.
I tried doing window.parent.myfunction() this…

Ovi
- 2,459
- 9
- 50
- 72
35
votes
2 answers
XML xpath, get the parent element till a specific element
I'm looking for the right xpath syntax to get a specific parent of an element.
Example:
root
|- div
| |
| |----??? ---|
| | |-a [class=1]
| | |- text[ A TEXT I DON'T WANT]
| |
|…

Nir Bentzy
- 351
- 1
- 3
- 3
33
votes
7 answers
Get 2 levels up from dirname( __FILE__)
How can I return the pathname from the current file, only 2 directories up?
So if I my current file URL is returning theme/includes/functions.php
How can I return "theme/"
Currently I am using
return dirname(__FILE__)

levi
- 23,693
- 18
- 59
- 73
33
votes
6 answers
calling child class method from parent class file in python
parent.py:
class A(object):
def methodA(self):
print("in methodA")
child.py:
from parent import A
class B(A):
def methodb(self):
print("am in methodb")
Is there anyway to call methodb() in parent.py?

Jagadeesh N M
- 625
- 1
- 5
- 9
32
votes
3 answers
29
votes
1 answer
Python importing a module from a parallel directory
How would I organize my python imports so that I can have a directory like this.
project
| \
| __init__.py
|
src
| \
| __init__.py
| classes.py
|
test
\
__init__.py
tests.py
And then inside…

Zack
- 13,454
- 24
- 75
- 113
29
votes
2 answers
PHP: self:: vs parent:: with extends
I'm wondering what is the difference between using self:: and parent:: when a static child class is extending static parent class e.g.
class Parent {
public static function foo() {
echo 'foo';
}
}
class Child extends Parent {
…

djkprojects
- 425
- 1
- 5
- 8
28
votes
1 answer
using postmessage to refresh iframe's parent document
I have a greasemonkey script that opens an iframe containing a form from a different sub-domain as the parent page.
I would like to refresh the parent page when the iframe refreshes after the form submission
I am at the point where I can execute a…

aperture
- 2,905
- 3
- 35
- 58
28
votes
6 answers
Show child element above parent element using CSS
I have two divs, one nested inside of the other. The parent element has a defined width/height. How can I show the child div above the parent (outside of it) using only CSS?
EDIT: Sorry, maybe I should clarify that I mean "above" as along the z…

zacharyliu
- 25,578
- 4
- 21
- 15
28
votes
5 answers
Access parent class instance attribute from child class instance?
How to access "myvar" from "child" in this code example:
class Parent():
def __init__(self):
self.myvar = 1
class Child(Parent):
def __init__(self):
Parent.__init__(self)
# this won't work
…
user975135
27
votes
1 answer
WPF pass parent binding object to the converter
I have ItemsControl that is bound to collection of type Student.
Inside the ItemTemplate I have a TextBox that uses IValueConverter to do some custom calculations and logic. I want to pass the actual Student object to the value converter, instead a…

Tomislav Markovski
- 12,331
- 7
- 50
- 72
27
votes
8 answers
How do I set the working directory of the parent process?
As the title reveals it, we are writing a Unix-style shell utility U that is supposed to be invoked (in most cases) from bash.
How exactly could U change the working directory of bash (or parent in general)?
P.S. The shell utility chdir succeeds in…

user285728
- 273
- 1
- 3
- 4
26
votes
3 answers
does foreign key always reference to a unique key in another table?
Is it not possible that foreign key(single column) in a child table references to a parent key which has some duplicate values?

ratsy
- 575
- 4
- 7
- 13