At 8:19 +0200 22/6/05, Frank Heckenbach wrote:
Peter N Lewis wrote:
b) a name in a parent object, with the same parameters (same by type anyway, the formal parameter name is not typically checked, although GPC typically requires the formal names to match), and must have "override"
The latter condition is a consequence of the fact that all methods are virtual. If we support/require `override' without all-methods-virtual in another dialect (mix), this condition wouldn't apply IMHO.
Which condition do you mean? The matching parameters?
Ok, so lets see if I understand the rules you are suggesting. For a given subclassed object method p, which might be virtual or static, there are three possible parent method states: no method named p in any parent; a static method named p in a parent method; a virtual method named p in a parent method. It is also possible there might be a mix of static and virtual methods named p, I presume only the most recently (object hierarchy wise) defined one would be relevant.
So that gives six possible combinations:
1. static method p defined and no method named p in any parent Legal. "override" is not allowed. "inherited p" not allowed.
2. virtual method p defined and no method named p in any parent Legal. "override" is not allowed. "inherited p" not allowed.
3. static method p defined where a static method named p in a parent Legal. "override" is required if enabled. "inherited p" is ok. Does parameters have to match? Is any warning given if no "override"?
4. virtual method p defined where a static method named p in a parent Is this legal? "override" is required if enabled. "inherited p" is ok. Does parameters have to match? Is any warning given if no "override"?
5. static method p defined where a virtual method named p in a parent Is this legal? "override" is required if enabled. "inherited p" is ok. Does parameters have to match? Is any warning given if no "override"?
6. virtual method p defined where a virtual method named p in a parent Legal. "override" is required if enabled. "inherited p" is ok. Does parameters have to match? Is any warning given if no "override"?
Whether a method is virtual or static depends on whether the "virtual" keyword is there or the dialect "all-methods-virtual" state.
Whether override is enabled depends on the dialect "override" state. I would think if the override dialect is enabled, then it would be required in any of the last four cases. Peter.