473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inheritence and Interfaces.

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.
Nov 21 '05 #1
2 1005
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
"Elephant" <el******@microsoft.com> escribió en el mensaje
news:SL********************@casema.nl...
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.

Nov 21 '05 #2
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
"Elephant" <el******@microsoft.com> escribió en el mensaje
news:SL********************@casema.nl...
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.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
Hi, I am trying to create a class heirarchy similar to the following: // base interface class ICar { public: virtual void start() = 0; }; // add members to that interface, but retain base...
8
by: Digital Puer | last post by:
I made the following table to help me (re)learn inheritence basics. Can someone check if it's correct? This table requires a courier-like font. Java C++ ---- ...
5
by: john bailo | last post by:
For a c# web application, I created a user control that includes a form in control. The idea is, on the main Page, when the user clicks Submit from the master form, that makes the user control...
7
by: preetam | last post by:
Hi, This question is more towards design than towards c++ details. By looking at books on design patterns and various google threads on the same topic, I see that composition is favoured to...
1
by: Fuzzy | last post by:
The thread on 'why NOT to use interface?' has provoked a question - but I'll start a new thread.... Is there any performance difference that anyone is aware of between using interfaces for...
2
by: raffelm | last post by:
Bear with my while I try to explain... I've created these two interfaces: public interface ILoggingEvents { event LoggingWindowClosing OnClosing;} public interface ILogging { ... } I then...
5
by: Bob Rundle | last post by:
I heard that managed C++ in VS 2005 supports multiple inheritence. Is this true? Bob Rundle
3
by: Trammel | last post by:
Hi, I recently upgraded to VB.net from VB6.. and woah... I feel lost :¬O One of my reasons for upgrading is I was told that VB.net can do class inheritance and subclassing easier. ...
5
by: Neelesh Bodas | last post by:
This might be slightly off-topic. Many books on C++ consider multiple inheritence as an "advanced" concept. Bruce Eckel says in TICPP, volume 2 that "there was (and still is) a lot of...
11
by: Wayne Pedersen | last post by:
Need some help - and I may be doing this wrong, so please correct and suggest! I'm learning the MVP method, which I seem to have a good grasp of. Now I am trying something a bit more advanced. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.