VB.NET - Mutliple Inheritance

G

Guest

Okay say I was writing a game engine and it had two parts: The actual engine
and a map editor. Both the engine and the editor use the same classes to
store the information about the AI through a DLL so that I can use
Serialization. Now here's my problem: The engine's classes must also inherit
from a DirectX class so that they can be rendered onto the screen. Here is an
example:

(In the DLL)
Public Class myLevel
Public myVar As Integer
End Class

(In the Engine)
Public Class myRenderingLevel
Inherits myLevel
Inherits DX9_RenderClass
End Class

VB.NET doesn't support multiple inheritance, so is there some way I can work
around this without having to copy myLevel's code to myRenderingLevel? Maybe
if I created extra classes...?
 
T

tommaso.gastaldi

Hi Alex,

how about nesting a myLevel object within myRenderingLevel? I guess,
you will have an additional dot, but it could actually make clearer
when you are using the "myLevel" properties, methods, etc.:

(In the DLL)
Public Class myLevel
Public myVar As Integer
...
End Class

(In the Engine)
Public Class myRenderingLevel
Inherits DX9_RenderClass

Public myLevel as myLevel

End Class


-tom

http://151.100.3.84/TechnicalPreview/


Alex C. Barberi ha scritto:
 

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