Possible VB Inheritance bug: 
Author Message
 Possible VB Inheritance bug:

I've played with your example, changing the qualifiers of the classes,
adding a third class to check for differences when the grandparent is the
implementor, etc. and it seems you have already isolated the bug. It seems
to be that:

    When a NotInheritable derived Class Inherits from a base Class
    that Implements an Interface (directly or indirectly), calls through
    the interface on an instance of the derived class execute the base
    class' implementation.

This behaviour does not happen when the NotInheritable qualifier is removed.
(And a NotInheritable Class that Implements an Interface directly works
correctly, btw.)

I tried similar ideas to the other poster in this thread, but they cause
this error:

    error BC31037: 'ISomeInterface.SomeMethod' is already implemented by
    the base class 'SomeClass' and cannot be reimplemented

which caused me to think the behaviour was "by design", but that was clearly
not the case, as the expected behaviour is available to inheritable classes.

I know I'm effectively restating what you said, but I have confirmed what
you saw :-)

Mark Hurd

> If a base class implements an interface and a derived class inherits from
> the base class, but the derived class is then marked NotInheritable,
> whenever an interface method is invoked on the derived class, the base
> class's method gets called.

> I've attached a small VB.NET example to demonstrate.

Thu, 18 Sep 2003 18:29:25 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Possible VB Inheritance bug:

2. Subtle bug with VB.NET inheritance

3. Possible Bug, Possible Faulty code

4. How many levels of inheritance possible???

5. inheritance in VBScript possible?

6. inheritance in VBScript possible?

7. IDE Bug with Visual Inheritance?

8. ActiveX OCXs and VB.NET - possible bug

9. Possible bug in VB.NET

10. Possible VB Bug?


12. Please help me with possible VB-bug !


Powered by phpBB® Forum Software