Inheritence and Interfaces.

E

Elephant

Hello,

is it possible to inherit a class and give it an interface and then let the
interface methods point to the methods from the base class?

class BaseClass
....
end class

interface MyInterface
....
end interface

class ComeTogether
Inherits BaseClass
Inherits MyInterface
...
REM point the MyInterface members ( with same name ) to BaseClass
members.
end class

I want to create a BaseClass, and a class that derrives from that BaseClass.
The derrived class must get a COM interface, but this COM interface must
also expose some of the BaseClass methods.

Any Ideas?

Thank you,

Me.
 
C

Carlos J. Quintero [.NET MVP]

Try:

Public Interface MyInterface
Sub MyMethod()
End Interface

Public Class BaseClass
Public Sub MyMethod()

End Sub
End Class

Public Class DerivedClass
Inherits BaseClass
Implements MyInterface

Private Sub MyImplementedMethod() Implements MyInterface.MyMethod
MyBase.MyMethod()
End Sub

End Class

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top