John Thorhauer <[EMAIL PROTECTED]> wrote:
> Im trying to implement my own User class and I want to make sure I
> understand a couple concepts.  
> 
> If I implement the User class with a class called MyUser and add some
> functionality above and beyond the default implementation, how do I
> access that functionality within the RunData object?  
> 
> If I understand things correctly the Rundata object only stores the
> upcast User object so I will not have my custom methods available in the
> User object within RunData.  Do I have to place MyUser within RunData
> and get it from there?  If so how do I do that?  I hope I am making
> sense here.

I thought it just saves the reference to the object in the hashtable.  You
should have your user object eventhough it is being used through the User
interface.  The UserFactory will create an instance of your object.  So you
should just be able to cast it...

if ( rundata.getUser() instanceof MyUser )
{
     MyUser mu = (MyUser)rundata.getUser();
     /* do your stuff */
}
else
{
     /* error code? */
}

Or you could just attempt the cast and catch/not catch the exception...


Jeff Brekke
mailto:[EMAIL PROTECTED]
http://sites.netscape.net/ekkerbj


____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at 
http://webmail.netscape.com.


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to