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.
Applying Frank's corrections/clarifications, we have:
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, only the most recently (object hierarchy wise) defined one is 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. Parameters do not have to match.
4. virtual method p defined where a static method named p in a parent Legal. "override" is required if enabled. "inherited p" is ok. Parameters do not have to match.
5. static method p defined where a virtual method named p in a parent Not Legal. Warning emitted and automatically made virtual. See 6.
6. virtual method p defined where a virtual method named p in a parent Legal. "override" is required if enabled. "inherited p" is ok. Parameters must match.
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. If the override dialect is enabled, then "override" is required in any of the last four cases.
Enjoy, Peter.