Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Inheritance Dilemma
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Multiple Inheritance Dilemma
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01047884
Message ID:
01047884
Views:
51
I subclassed mmBusinessWebPage to make my own JdaBusinessWebPage class. I added a property called BasePath on my JdaBusinessWebPage class. I base all of the pages on my site from my class, except for the login page, which needs to subclass mmBaseUserLogin to get the login functionality from Kevin's login class.

Then, I created a user control that I want to put on every page of my website, including the login page. This control needs to access the new BasePath property. For a user control to access a property on a custom class like this, I have to cast this.Page to my class JdaBusinessWebPage to be able to access the custom property. That works fine on every page of my site, except for the login screen, because of couse the login page is not subclassed from my JdaBusinessWebPage class.

I know multiple inheritance is not possible in C#. But I don't know the best way to get around this kind of dilemma because it will come up again. I need the functionality of one of the Mere Mortals classes and of my class at the same time.

BTW, I actually subclass the mmBaseUserLogin as JdaUserLogin as well so I don't actually directly instantiate any of the Mere Mortals classes. Maybe there is a way for my custom control to look at the current page to see what it is subclassed from so I know how to cast it. That sure seems like a lot of overhead though!

Matthew J. Price
Next
Reply
Map
View

Click here to load this message in the networking platform