Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing mmUser
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Subclassing mmUser
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01013572
Message ID:
01013572
Vues:
51
I have added a new field to the MM_Secur.Users table to store an Init Vector. So I overloaded the mmUser class with my own class called JdaUser and I added a public member to store info for this field.
public class JdaUser : mmUser	{
	public string InitVecField;
Then I changed my Factory class to override the CreateUserObject() method so that it returns my JdaUser object.
public override mmUser CreateUserObject()
{
	return new JdaUser();
}
I have tried instantiating my JdaUser object with CreateUserObject() 2 different ways and they both give me compile-time errors.

1. Since CreateUserObject() actually returns a JdaUser object, I defined my variable as JdaUser. This gives me an error: "Cannot implicitly convert type 'OakLeaf.MM.Main.Security.mmUser' to 'Jda.Security.JdaUser'"
JdaUser User = mmAppBase.Factory.CreateUserObject();
2. If I try to define my variable as the old mmUser, I get a compile-time error when I try to use my new member: "'OakLeaf.MM.Main.Security.mmUser' does not contain a definition for 'InitVecField'"
mmUser User = mmAppBase.Factory.CreateUserObject();	
Console.WriteLine(User.InitVecField);
If I comment out the Console.WriteLine() line above, it will compile and I can step through the code and watch it actually create a JdaUser object. Does anyone know how I can get the compiler to realize that the JdaUser object will be created so my InitVecField member should be available to me???

Matthew J. Price
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform