Re: [sv-ec] Query related to virtual methods in a class

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Fri Oct 20 2006 - 08:25:38 PDT
Don Mills wrote:
[...]
> My conclusions are, none of the extended classes mid1, mid2, mid3 are 
> required to included and define the virtual task declared in virtual 
> base classes.
> 
> The reason I am asking all this is due to a sentence in section 7.19:
> "In general, if an abstract class has any virtual methods, all of the 
> methods must be overridden (and provided with a method body) for the 
> subclass to be instantiated."

Ah - this is the root of the problem.  This sentence is confusing
due to the earlier state of the LRM where "pure" wasn't used.  The
"method body" part of this used to be significant and isn't any
longer due to using "pure" to disambiguate a pure virtual from
a virtual with a trivial implementation.

The sentence should be changed to something along the lines of the following:
      If an abstract class has any pure virtual methods, any class
      extension shall either be abstract or shall override every
      remaining pure virtual method with an implementation of the method.

I threw in "remaining" to allude to the fact that intermediate
extensions (the "mid" classes) could have provided implementations
for some of the pure virtuals already.

> This implies to me that the virtual methods must be defined in the 
> extended classes.  Ummm, that is not what I am seeing from simulation.
> 
> (Note that I did not make any of the task "pure".)


Gord.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Fri Oct 20 08:25:41 2006

This archive was generated by hypermail 2.1.8 : Fri Oct 20 2006 - 08:25:49 PDT