F
Fiber Optic
If anyone has a suggestion for a better location for this post please
let me know. Thanks.
On page 45, of the Design Patterns text shows the following:
void MonoGlyph:raw(Window *w) {
_component->Draw(w);
}
Questions...
1. Is _component a member of Glyph or MonoGlyph?
2. What data type is _component?
3. There is an aggregate line in Figure 2.7 showing that "component" is
contained within MonoGlyph (or is it saying that MonoGlyph is the
component and is a data member of Glyph?), and Glyph contains a
reference to it. Or does it contain a reference to MonoGlyph, which is
contained within Glyph? I guess I'm having trouble understanding what
the line is showing. Can someone clarify?
4. 2nd paragraph says "MonoGlyph subclasses reimplement at least one of
these forwarding operations. Border:raw, for instance first invokes
the parent class operation MonoGlyph:raw on the component to let the
component do its part-that is, draw everything but th border."
void Border:raw(Window *w) {
MonoGlyph:raw(w);
DrawBorder(w);
}
What -is- the "everything" which they speak of? If I envision the border
to be a simple elongated filled rectangle, then what is
MonoGlyph:raw() drawing?
5. Class Scroller has a Draw(Window) method as well. Does scroller just
call the parent Draw() method? If so, then how does the Glyph:raw()
method know how to draw the scroller?
Any help appreciated.
Chris
let me know. Thanks.
On page 45, of the Design Patterns text shows the following:
void MonoGlyph:raw(Window *w) {
_component->Draw(w);
}
Questions...
1. Is _component a member of Glyph or MonoGlyph?
2. What data type is _component?
3. There is an aggregate line in Figure 2.7 showing that "component" is
contained within MonoGlyph (or is it saying that MonoGlyph is the
component and is a data member of Glyph?), and Glyph contains a
reference to it. Or does it contain a reference to MonoGlyph, which is
contained within Glyph? I guess I'm having trouble understanding what
the line is showing. Can someone clarify?
4. 2nd paragraph says "MonoGlyph subclasses reimplement at least one of
these forwarding operations. Border:raw, for instance first invokes
the parent class operation MonoGlyph:raw on the component to let the
component do its part-that is, draw everything but th border."
void Border:raw(Window *w) {
MonoGlyph:raw(w);
DrawBorder(w);
}
What -is- the "everything" which they speak of? If I envision the border
to be a simple elongated filled rectangle, then what is
MonoGlyph:raw() drawing?
5. Class Scroller has a Draw(Window) method as well. Does scroller just
call the parent Draw() method? If so, then how does the Glyph:raw()
method know how to draw the scroller?
Any help appreciated.
Chris