Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple Inheritance Dilemma
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Multiple Inheritance Dilemma
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01047884
Message ID:
01047884
Vues:
50
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform