Inheritance question

  • Thread starter Thread starter Jason MacKenzie
  • Start date Start date
J

Jason MacKenzie

I have a higher level question about inheritance. We have a base class that
all our intranet pages inherit that does things like our navigation menu,
security etc. That works great is amazingly simple.

We also have an assembly that we use in most pages that holds our commonly
used functions such as returning a datatable, binding grids etc. It's
originally named CommonFunctions.dll .

It makes sense to me to try to expose those methods through the base page
class but I'm not sure what the best approach is. It would be nice to
inherit System.Web.UI.Page and CommonFunctions in my base page class but you
can't do that.

Any direction is greatly appreciated,

Jason
 
What you would like is "Multiple Inheritance" and is not possible in VB.NET.
You could try "Multi-Level Inheritance"...Create your custom page class and
have it inherit from the System.Web.UI.Page class.

Then create a new class that Inherits from the custom page class you just
made.
 
Hi,
Multiple Inheritance is not possible in .NEt, but you can implement
multiple interfaces and also inherit from a class and implement an
interface. So you can define a i interface with the common functions and
implement that it in the baseclass and then as you inherit from the
baseclass, you can still use the functions. If you need to add more
methods, then you can add it to the interface or just create a new
interface and implement it in your baseclass. Fro example

Interface Test
Sub foo()
End Interface
Class base
Implements Test
Sub foo() Implements Test.foo
MsgBox(" in test")
End Sub
End Class
Class dervied
Inherits base
Public Sub testFun()
Me.foo()
End Sub
End Class





Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks
 
Back
Top