PDA

View Full Version : Is this sentence correct?



SWEngineer
26th April 2011, 18:58
At the end of the following webpage: http://web.mit.edu/qt-dynamic/www/tutorials-tutorial-t4.html

This sentence is mentioned under the main() function:

Here we instantiate our new child, show it, and execute the application.

Is it correct to say "child" here? If so, why is "MyWidget" considered a child?

Thanks.

helloworld
26th April 2011, 20:47
It does seem inconsistent with the rest of the text since it is not created with a parent widget.

Rachol
20th June 2011, 11:31
Every widget is a child of the application, so I would say it is correct to say that a child has been instantiated.

helloworld
20th June 2011, 19:08
I think it's a mistake. Up to that point in the text, the terminology is consistent:


A child widget is a widget constructed with a parent widget (window).
A widget without a parent widget is always an independent window.

In the final example, MyWidget is clearly a window in this context since it has no parent (widget.parent() is 0).

Unless child here refers to parent/child relationship in the class hierarchy, i.e. inheritance (the text reads "we instantiate our new child," which suggests that the subject is an object, not a class) it is at least ambiguous.

Santosh Reddy
20th June 2011, 19:43
It is a child with no parent. Note that that this instance (widget) does not have a parent, otherwise this class of chidlren (MyWidget) can have parents, hence the statement is not worng.

helloworld
21st June 2011, 00:51
MyWidget is a child class of QWidget. Is this what you mean? If so, I agree on that part but I am just saying that the terminology is not clear since the rest of the text is talking about parent/child relationship in the context of the QObject tree hierarchy. So, child; as in MyWidget/QWidget; yes, but most readers will probably read it as child widget. But it's not a child widget... or? Maybe I misunderstood you here. To me the concept of a child widget here is a widget being constructed with a parent widget (e.g., QPushButton quit("Quit", &window); ).

The part "we instantiate our new child" implies that child here is an object, the widget to be specific, and not a class. This, plus the rest of the text suggests that the author is not referring to a class inheritance type-of parent/child relationship.

wysota
21st June 2011, 01:56
When it comes to subclassing the usual naming is "base" (or "super") and "derived" (or "descendant") class. Parent-child terminology is reserved for objects. On the other hand a "child widget" is a term of its own. It means a widget that is not a window (regardless whether the particular technology has the notion of parents and children).

In the text mentioned the problematic part seems to be a residue after some other text.